Class X509KeyIdentifierUtil

java.lang.Object
org.apache.wss4j.common.crypto.X509KeyIdentifierUtil

public final class X509KeyIdentifierUtil extends Object
Decodes the X.509 key identifier extensions.
  • Method Details

    • getAuthorityKeyIdentifierBytes

      public static byte[] getAuthorityKeyIdentifierBytes(X509Certificate cert)
      Read the keyIdentifier of the AuthorityKeyIdentifier extension (2.5.29.35) of the given certificate.

      X.509 extensions are required to use DER; BER encodings are rejected.

      Parameters:
      cert - the certificate to read the AuthorityKeyIdentifier from.
      Returns:
      an empty array if the certificate has no AuthorityKeyIdentifier extension, null if the extension is present but carries no keyIdentifier, otherwise the keyIdentifier.
      Throws:
      IllegalArgumentException - if the extension is present but is not valid DER.
    • getSubjectKeyIdentifierBytes

      public static byte[] getSubjectKeyIdentifierBytes(X509Certificate cert)
      Read the SubjectKeyIdentifier extension (2.5.29.14) of the given certificate.

      X.509 extensions are required to use DER; BER encodings are rejected.

      Parameters:
      cert - the certificate to read the SubjectKeyIdentifier from.
      Returns:
      an empty array if the certificate has no SubjectKeyIdentifier extension, otherwise the key identifier.
      Throws:
      IllegalArgumentException - if the extension is present but is not valid DER.