Ejemplo n.º 1
0
 private byte[] getAuthorityKeyId(X509Certificate cert) throws IOException {
   byte[] extvalue = cert.getExtensionValue(X509Extensions.AuthorityKeyIdentifier.getId());
   if (extvalue == null) {
     return null;
   }
   DEROctetString oct =
       (DEROctetString) (new ASN1InputStream(new ByteArrayInputStream(extvalue)).readObject());
   AuthorityKeyIdentifier keyId =
       new AuthorityKeyIdentifier(
           (ASN1Sequence)
               new ASN1InputStream(new ByteArrayInputStream(oct.getOctets())).readObject());
   return keyId.getKeyIdentifier();
 }
Ejemplo n.º 2
0
 /**
  * Reads the value of the <code>AuthorityKeyIdentifier</code> extension field of the certificate.
  *
  * @return Authority key identifier.
  */
 public AuthorityKeyIdentifier readAuthorityKeyIdentifier() {
   return AuthorityKeyIdentifier.getInstance(read(ExtensionType.AuthorityKeyIdentifier));
 }