private void setCertificateHolderReference(ASN1ApplicationSpecific certificateHolderReference) throws IllegalArgumentException { if (certificateHolderReference.getApplicationTag() == EACTags.CARDHOLDER_NAME) { this.certificateHolderReference = certificateHolderReference; certificateType |= CHR; } else { throw new IllegalArgumentException("Not an Iso7816Tags.CARDHOLDER_NAME tag"); } }
/** * set the date after wich the certificate expires * * @param ced ASN1ApplicationSpecific containing the date after wich the certificate expires * @throws IllegalArgumentException if the tag is not Iso7816Tags.APPLICATION_EXPIRATION_DATE */ private void setCertificateExpirationDate(ASN1ApplicationSpecific ced) throws IllegalArgumentException { if (ced.getApplicationTag() == EACTags.APPLICATION_EXPIRATION_DATE) { this.certificateExpirationDate = ced; certificateType |= CExD; } else { throw new IllegalArgumentException("Not an Iso7816Tags.APPLICATION_EXPIRATION_DATE tag"); } }
/** * set the CertificationAuthorityReference. * * @param certificationAuthorityReference * the ASN1ApplicationSpecific containing the CertificationAuthorityReference. * @throws IllegalArgumentException if the ASN1ApplicationSpecific is not valid. */ private void setCertificationAuthorityReference( ASN1ApplicationSpecific certificationAuthorityReference) throws IllegalArgumentException { if (certificationAuthorityReference.getApplicationTag() == EACTags.ISSUER_IDENTIFICATION_NUMBER) { this.certificationAuthorityReference = certificationAuthorityReference; certificateType |= CAR; } else { throw new IllegalArgumentException("Not an Iso7816Tags.ISSUER_IDENTIFICATION_NUMBER tag"); } }
private void setCertificateProfileIdentifier(ASN1ApplicationSpecific certificateProfileIdentifier) throws IllegalArgumentException { if (certificateProfileIdentifier.getApplicationTag() == EACTags.INTERCHANGE_PROFILE) { this.certificateProfileIdentifier = certificateProfileIdentifier; certificateType |= CPI; } else { throw new IllegalArgumentException("Not an Iso7816Tags.INTERCHANGE_PROFILE tag :" + EACTags.encodeTag(certificateProfileIdentifier)); } }
/** * set the date of the certificate generation * * @param ced ASN1ApplicationSpecific containing the date of the certificate generation * @throws IllegalArgumentException if the tag is not Iso7816Tags.APPLICATION_EFFECTIVE_DATE */ private void setCertificateEffectiveDate(ASN1ApplicationSpecific ced) throws IllegalArgumentException { if (ced.getApplicationTag() == EACTags.APPLICATION_EFFECTIVE_DATE) { this.certificateEffectiveDate = ced; certificateType |= CEfD; } else { throw new IllegalArgumentException("Not an Iso7816Tags.APPLICATION_EFFECTIVE_DATE tag :" + EACTags.encodeTag(ced)); } }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("["); if (isConstructed()) { sb.append("CONSTRUCTED "); } sb.append("APPLICATION "); sb.append(Integer.toString(getApplicationTag())); sb.append("]"); // @todo content encoding somehow? if (this.octets != null) { sb.append(" #"); sb.append(Hex.toHexString(this.octets)); } else { sb.append(" #null"); } sb.append(" "); return sb.toString(); } }
int tag = spec.getApplicationTag();
private void initCertBody(ASN1ApplicationSpecific request) throws IOException if (request.getApplicationTag() == EACTags.CARDHOLDER_CERTIFICATE) switch (obj.getApplicationTag()) break; default: throw new IOException("Invalid tag, not an CV Certificate Request element:" + obj.getApplicationTag()); throw new IOException("Invalid CARDHOLDER_CERTIFICATE in request:" + request.getApplicationTag()); throw new IOException("not a CARDHOLDER_CERTIFICATE in request:" + request.getApplicationTag());
if (appSpe.getApplicationTag() == EACTags.CARDHOLDER_CERTIFICATE) switch (aSpe.getApplicationTag()) break; default: throw new IOException("Invalid tag, not an Iso7816CertificateStructure :" + aSpe.getApplicationTag()); throw new IOException("not a CARDHOLDER_CERTIFICATE :" + appSpe.getApplicationTag()); throw new IOException("invalid CARDHOLDER_CERTIFICATE :" + appSpe.getApplicationTag());
/** * create an Iso7816CertificateHolderAuthorization according to the {@link ASN1ApplicationSpecific} * * @param aSpe the DERApplicationSpecific containing the data * @throws IOException */ public CertificateHolderAuthorization(ASN1ApplicationSpecific aSpe) throws IOException { if (aSpe.getApplicationTag() == EACTags.CERTIFICATE_HOLDER_AUTHORIZATION_TEMPLATE) { setPrivateData(new ASN1InputStream(aSpe.getContents())); } }
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; }
if (appSpe.getApplicationTag() == EACTags.CERTIFICATE_CONTENT_TEMPLATE) switch (aSpe.getApplicationTag()) default: certificateType = 0; throw new IOException("Not a valid iso7816 ASN1ApplicationSpecific tag " + aSpe.getApplicationTag());
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); } }