我正在使用bouncy castle 1.48來驗證OCSP的證書驗證。它運作良好。 但我使用Ocp Url作爲靜態變量,我想從證書中讀取它。網址是寫在證書Authority Info Access
Java Bouncy Castle OCSP Url
[1]Authority Info Access
Access Method=On-line Certificate Status Protocol (1.3.6.1.5.5.7.48.1)
Alternative Name:
URL=http://ocsp.mydomain
我從證書
byte[] octetBytes = certificate.getExtensionValue(X509Extension.authorityInfoAccess.getId());
ASN1InputStream octetStream = new ASN1InputStream(octetBytes);
byte[] encoded = X509ExtensionUtil.fromExtensionValue(octetBytes).getEncoded();
ASN1Sequence seq = ASN1Sequence.getInstance(ASN1Primitive.fromByteArray(encoded));
AuthorityInformationAccess access = AuthorityInformationAccess.getInstance(seq);
其寫入AuthorityInformationAccess: Oid(1.3.6.1.5.5.7.48.1)
org.bouncycastle.asn1.x509.AuthorityInformationAccess
對象,但不能從那裏