Class KeyUsageExtension
java.lang.Object
com.itextpdf.signatures.validation.extensions.CertificateExtension
com.itextpdf.signatures.validation.extensions.KeyUsageExtension
Class representing "Key Usage" extenstion.
-
Field Summary
FieldsFields inherited from class com.itextpdf.signatures.validation.extensions.CertificateExtension
EXCEPTION_OCCURRED, EXPECTED_EXTENSION_ID_AND_VALUE, EXTENSION_NOT_FOUND, FOUND_VALUE
-
Constructor Summary
ConstructorsConstructorDescriptionKeyUsageExtension
(int keyUsage) Create newKeyUsageExtension
instance using providedint
flag.KeyUsageExtension
(int keyUsage, boolean resultOnMissingExtension) Create newKeyUsageExtension
instance using providedint
flag.KeyUsageExtension
(KeyUsage keyUsageValue) Create newKeyUsageExtension
instance using provided single key usage enum value.KeyUsageExtension
(KeyUsage keyUsageValue, boolean resultOnMissingExtension) Create newKeyUsageExtension
instance using provided single key usage enum value.KeyUsageExtension
(List<KeyUsage> keyUsages) Create newKeyUsageExtension
instance using provided key usage enum list.KeyUsageExtension
(List<KeyUsage> keyUsages, boolean resultOnMissingExtension) Create newKeyUsageExtension
instance using provided key usage enum list. -
Method Summary
Modifier and TypeMethodDescriptionboolean
existsInCertificate
(X509Certificate certificate) Check if this extension is present in the provided certificate.Returns a message with extra information about the check.Methods inherited from class com.itextpdf.signatures.validation.extensions.CertificateExtension
equals, getExtensionOid, getExtensionValue, hashCode
-
Field Details
-
EXPECTED_VALUE
- See Also:
-
ACTUAL_VALUE
- See Also:
-
MISSING_VALUE
- See Also:
-
-
Constructor Details
-
KeyUsageExtension
public KeyUsageExtension(int keyUsage) Create newKeyUsageExtension
instance using providedint
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 newKeyUsageExtension
instance using providedint
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 forexistsInCertificate(X509Certificate)
method in case of the extension not being present in a certificate
-
KeyUsageExtension
Create newKeyUsageExtension
instance using provided key usage enum list.- Parameters:
-
keyUsages
- key usagesList
which represents key usage values
-
KeyUsageExtension
Create newKeyUsageExtension
instance using provided key usage enum list.- Parameters:
-
keyUsages
- key usagesList
which represents key usage values -
resultOnMissingExtension
- parameter which represents return value forexistsInCertificate(X509Certificate)
method in case of the extension not being present in a certificate
-
KeyUsageExtension
Create newKeyUsageExtension
instance using provided single key usage enum value.- Parameters:
-
keyUsageValue
-KeyUsage
which represents single key usage enum value
-
KeyUsageExtension
Create newKeyUsageExtension
instance using provided single key usage enum value.- Parameters:
-
keyUsageValue
-KeyUsage
which represents single key usage enum value -
resultOnMissingExtension
- parameter which represents return value forexistsInCertificate(X509Certificate)
method in case of the extension not being present in a certificate
-
-
Method Details
-
existsInCertificate
Check if this extension is present in the provided certificate. In case ofKeyUsageExtension
, check if this key usage bit values are present in certificate. Other values may be present as well.- Overrides:
-
existsInCertificate
in classCertificateExtension
- 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
Description copied from class:CertificateExtension
Returns a message with extra information about the check.- Overrides:
-
getMessage
in classCertificateExtension
- Returns:
- a message with extra information about the check.
-