Class KeyUsageExtension

java.lang.Object
com.itextpdf.signatures.validation.extensions.CertificateExtension
com.itextpdf.signatures.validation.extensions.KeyUsageExtension

public class KeyUsageExtension extends CertificateExtension
Class representing "Key Usage" extenstion.
  • Field Details

  • Constructor Details

    • KeyUsageExtension

      public KeyUsageExtension (int keyUsage)
      Create new KeyUsageExtension instance using provided int flag.
      Parameters:
      keyUsage - int flag which represents bit values for key usage value bit strings are stored with the big-endian byte order and padding on the end, the big endian notation causes a shift in actual integer values for bits 1-8 becoming 0-7 and bit 1 the 7 bits padding makes for bit 0 to become bit 7 of the first byte
    • KeyUsageExtension

      public KeyUsageExtension (int keyUsage, boolean resultOnMissingExtension)
      Create new KeyUsageExtension instance using provided int flag.
      Parameters:
      keyUsage - int flag which represents bit values for key usage value bit strings are stored with the big-endian byte order and padding on the end, the big endian notation causes a shift in actual integer values for bits 1-8 becoming 0-7 and bit 1 the 7 bits padding makes for bit 0 to become bit 7 of the first byte
      resultOnMissingExtension - parameter which represents return value for existsInCertificate(X509Certificate) method in case of the extension not being present in a certificate
    • KeyUsageExtension

      public KeyUsageExtension (List<KeyUsage> keyUsages)
      Create new KeyUsageExtension instance using provided key usage enum list.
      Parameters:
      keyUsages - key usages List which represents key usage values
    • KeyUsageExtension

      public KeyUsageExtension (List<KeyUsage> keyUsages, boolean resultOnMissingExtension)
      Create new KeyUsageExtension instance using provided key usage enum list.
      Parameters:
      keyUsages - key usages List which represents key usage values
      resultOnMissingExtension - parameter which represents return value for existsInCertificate(X509Certificate) method in case of the extension not being present in a certificate
    • KeyUsageExtension

      public KeyUsageExtension (KeyUsage keyUsageValue)
      Create new KeyUsageExtension instance using provided single key usage enum value.
      Parameters:
      keyUsageValue - KeyUsage which represents single key usage enum value
    • KeyUsageExtension

      public KeyUsageExtension (KeyUsage keyUsageValue, boolean resultOnMissingExtension)
      Create new KeyUsageExtension instance using provided single key usage enum value.
      Parameters:
      keyUsageValue - KeyUsage which represents single key usage enum value
      resultOnMissingExtension - parameter which represents return value for existsInCertificate(X509Certificate) method in case of the extension not being present in a certificate
  • Method Details

    • existsInCertificate

      public boolean existsInCertificate (X509Certificate certificate)
      Check if this extension is present in the provided certificate. In case of KeyUsageExtension, check if this key usage bit values are present in certificate. Other values may be present as well.
      Overrides:
      existsInCertificate in class CertificateExtension
      Parameters:
      certificate - X509Certificate in which this extension shall be present
      Returns:
      true if this key usage bit values are present in certificate, false otherwise
    • getMessage

      public String getMessage()
      Description copied from class: CertificateExtension
      Returns a message with extra information about the check.
      Overrides:
      getMessage in class CertificateExtension
      Returns:
      a message with extra information about the check.