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 newKeyUsageExtensioninstance using providedintflag.KeyUsageExtension(int keyUsage, boolean resultOnMissingExtension) Create newKeyUsageExtensioninstance using providedintflag.KeyUsageExtension(KeyUsage keyUsageValue) Create newKeyUsageExtensioninstance using provided single key usage enum value.KeyUsageExtension(KeyUsage keyUsageValue, boolean resultOnMissingExtension) Create newKeyUsageExtensioninstance using provided single key usage enum value.KeyUsageExtension(List<KeyUsage> keyUsages) Create newKeyUsageExtensioninstance using provided key usage enum list.KeyUsageExtension(List<KeyUsage> keyUsages, boolean resultOnMissingExtension) Create newKeyUsageExtensioninstance using provided key usage enum list. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsInCertificate(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 newKeyUsageExtensioninstance using providedintflag.- Parameters:
-
keyUsage-intflag 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 newKeyUsageExtensioninstance using providedintflag.- Parameters:
-
keyUsage-intflag 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 newKeyUsageExtensioninstance using provided key usage enum list.- Parameters:
-
keyUsages- key usagesListwhich represents key usage values
-
KeyUsageExtension
Create newKeyUsageExtensioninstance using provided key usage enum list.- Parameters:
-
keyUsages- key usagesListwhich 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 newKeyUsageExtensioninstance using provided single key usage enum value.- Parameters:
-
keyUsageValue-KeyUsagewhich represents single key usage enum value
-
KeyUsageExtension
Create newKeyUsageExtensioninstance using provided single key usage enum value.- Parameters:
-
keyUsageValue-KeyUsagewhich 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:
-
existsInCertificatein classCertificateExtension - Parameters:
-
certificate-X509Certificatein which this extension shall be present - Returns:
-
trueif this key usage bit values are present in certificate,falseotherwise
-
getMessage
Description copied from class:CertificateExtensionReturns a message with extra information about the check.- Overrides:
-
getMessagein classCertificateExtension - Returns:
- a message with extra information about the check.
-