/** * <pre> * CMPCertificate ::= CHOICE { * x509v3PKCert Certificate * otherCert [tag] EXPLICIT ANY DEFINED BY tag * } * </pre> * Note: the addition of the explicit tagging is a BC extension. We apologise for the warped syntax, but hopefully you get the idea. * * @return a basic ASN.1 object representation. */ public ASN1Primitive toASN1Primitive() { if (otherCert != null) { // explicit following CMP conventions return new DERTaggedObject(true, otherTagValue, otherCert); } return x509v3PKCert.toASN1Primitive(); } }
/** * <pre> * CMPCertificate ::= CHOICE { * x509v3PKCert Certificate * otherCert [tag] EXPLICIT ANY DEFINED BY tag * } * </pre> * Note: the addition of the explicit tagging is a BC extension. We apologise for the warped syntax, but hopefully you get the idea. * * @return a basic ASN.1 object representation. */ public ASN1Primitive toASN1Primitive() { if (otherCert != null) { // explicit following CMP conventions return new DERTaggedObject(true, otherTagValue, otherCert); } return x509v3PKCert.toASN1Primitive(); } }
if (Arrays.areEqual(encPrivData.getCertificateChain()[0].toASN1Primitive().getEncoded(), encodedCert))
/** * Produce an object suitable for an ASN1OutputStream. * <p> * Returns: * <pre> * RequestedCertificate ::= CHOICE { * Certificate Certificate, * publicKeyCertificate [0] EXPLICIT OCTET STRING, * attributeCertificate [1] EXPLICIT OCTET STRING * } * </pre> * * @return a DERObject */ public ASN1Primitive toASN1Primitive() { if (publicKeyCert != null) { return new DERTaggedObject(0, new DEROctetString(publicKeyCert)); } if (attributeCert != null) { return new DERTaggedObject(1, new DEROctetString(attributeCert)); } return cert.toASN1Primitive(); } }
/** * Produce an object suitable for an ASN1OutputStream. * <p> * Returns: * <pre> * RequestedCertificate ::= CHOICE { * Certificate Certificate, * publicKeyCertificate [0] EXPLICIT OCTET STRING, * attributeCertificate [1] EXPLICIT OCTET STRING * } * </pre> * * @return a DERObject */ public ASN1Primitive toASN1Primitive() { if (publicKeyCert != null) { return new DERTaggedObject(0, new DEROctetString(publicKeyCert)); } if (attributeCert != null) { return new DERTaggedObject(1, new DEROctetString(attributeCert)); } return cert.toASN1Primitive(); } }