/** * Gives an instance of Iso7816CertificateBody taken from Object obj * * @param obj is the Object to extract the certificate body from. * @return the Iso7816CertificateBody taken from Object obj. * @throws IOException if object is not valid. */ public static CertificateBody getInstance(Object obj) throws IOException { if (obj instanceof CertificateBody) { return (CertificateBody)obj; } else if (obj != null) { return new CertificateBody(ASN1ApplicationSpecific.getInstance(obj)); } return null; }
/** * Return an ASN1ApplicationSpecific from the passed in object, which may be a byte array, or null. * * @param obj the object to be converted. * @return obj's representation as an ASN1ApplicationSpecific object. */ public static ASN1ApplicationSpecific getInstance(Object obj) { if (obj == null || obj instanceof ASN1ApplicationSpecific) { return (ASN1ApplicationSpecific)obj; } else if (obj instanceof byte[]) { try { return ASN1ApplicationSpecific.getInstance(ASN1Primitive.fromByteArray((byte[])obj)); } catch (IOException e) { throw new IllegalArgumentException("Failed to construct object from byte[]: " + e.getMessage()); } } throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName()); }
public static CVCertificateRequest getInstance(Object obj) { if (obj instanceof CVCertificateRequest) { return (CVCertificateRequest)obj; } else if (obj != null) { try { return new CVCertificateRequest(ASN1ApplicationSpecific.getInstance(obj)); } catch (IOException e) { throw new ASN1ParsingException("unable to parse data: " + e.getMessage(), e); } } return null; }
/** * Create an iso7816Certificate structure from an object. * * @param obj the Object to extract the certificate from. * @return the Iso7816CertificateStructure represented by the byte stream. */ public static CVCertificate getInstance(Object obj) { if (obj instanceof CVCertificate) { return (CVCertificate)obj; } else if (obj != null) { try { return new CVCertificate(ASN1ApplicationSpecific.getInstance(obj)); } catch (IOException e) { throw new ASN1ParsingException("unable to parse data: " + e.getMessage(), e); } } return null; }
private static String outputApplicationSpecific(String type, String indent, boolean verbose, ASN1Primitive obj, String nl) { ASN1ApplicationSpecific app = ASN1ApplicationSpecific.getInstance(obj); StringBuffer buf = new StringBuffer(); if (app.isConstructed()) { try { ASN1Sequence s = ASN1Sequence.getInstance(app.getObject(BERTags.SEQUENCE)); buf.append(indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "]" + nl); for (Enumeration e = s.getObjects(); e.hasMoreElements();) { _dumpAsString(indent + TAB, verbose, (ASN1Primitive)e.nextElement(), buf); } } catch (IOException e) { buf.append(e); } return buf.toString(); } return indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "] (" + Strings.fromByteArray(Hex.encode(app.getContents())) + ")" + nl; }
private CVCertificateRequest(ASN1ApplicationSpecific request) throws IOException { this.original = request; if (request.isConstructed() && request.getApplicationTag() == EACTags.AUTHENTIFICATION_DATA) { ASN1Sequence seq = ASN1Sequence.getInstance(request.getObject(BERTags.SEQUENCE)); initCertBody(ASN1ApplicationSpecific.getInstance(seq.getObjectAt(0))); outerSignature = ASN1ApplicationSpecific.getInstance(seq.getObjectAt(seq.size() - 1)).getContents(); } else { initCertBody(request); } }
for (Enumeration en = seq.getObjects(); en.hasMoreElements();) ASN1ApplicationSpecific obj = ASN1ApplicationSpecific.getInstance(en.nextElement()); switch (obj.getApplicationTag())