List of usage examples for org.bouncycastle.asn1 ASN1OctetString getOctetStream
public InputStream getOctetStream()
From source file:support.revocation.OCSP.java
License:Apache License
/** * @return the parsed encoded ASN1 structure * @param octets/*from ww w .j a v a2s . co m*/ * @throws IOException */ private static ASN1Primitive parseASN1(ASN1OctetString octets) throws IOException { try (InputStream octetStream = octets.getOctetStream(); ASN1InputStream asn1stream = new ASN1InputStream(octetStream)) { return asn1stream.readObject(); } }
From source file:support.revocation.RevocationInfo.java
License:Apache License
/** * @return the parsed X.509 certificate extension with the specified OID for * the given certificate// www. j av a 2 s . c o m * @param certificate * @param oid */ private static ASN1Primitive certificateExtension(X509Certificate certificate, String oid) { byte[] value = certificate.getExtensionValue(oid); ASN1OctetString octetString; if (value != null) try { try (ByteArrayInputStream valueStream = new ByteArrayInputStream(value); ASN1InputStream asn1stream = new ASN1InputStream(valueStream)) { octetString = (ASN1OctetString) asn1stream.readObject(); } try (InputStream octetStream = octetString.getOctetStream(); ASN1InputStream asn1stream = new ASN1InputStream(octetStream)) { return asn1stream.readObject(); } } catch (IOException e) { e.printStackTrace(); } return null; }