public static X500Principal getIssuerX500Principal ( X509CRL crl ) { try { byte [ ] encoded = crl . getEncoded ( ) ; DerInputStream derIn = new DerInputStream ( encoded ) ; DerValue tbsCert = derIn . getSequence ( 3 ) [ 0 ] ; DerInputStream tbsIn = tbsCert . data ; DerValue tmp ; // skip version number if present byte nextByte = ( byte ) tbsIn . peekByte ( ) ; if ( nextByte == DerValue . tag_Integer ) { tmp = tbsIn . getDerValue ( ) ; } tmp = tbsIn . getDerValue ( ) ; // skip signature tmp = tbsIn . getDerValue ( ) ; // issuer byte [ ] principalBytes = tmp . toByteArray ( ) ; return new X500Principal ( principalBytes ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not parse issuer" , e ) ; } }
Extract the issuer X500Principal from an X509CRL . Parses the encoded form of the CRL to preserve the principal s ASN . 1 encoding .