public class KeyUsageExtension extends CertificateExtension
| Modifier and Type | Field and Description |
|---|---|
static String |
ACTUAL_VALUE |
static String |
EXPECTED_VALUE |
static String |
MISSING_VALUE |
EXCEPTION_OCCURRED, EXPECTED_EXTENSION_ID_AND_VALUE, EXTENSION_NOT_FOUND, FOUND_VALUE| Constructor and Description |
|---|
KeyUsageExtension(int keyUsage)
Create new
KeyUsageExtension instance using provided int flag. |
KeyUsageExtension(int keyUsage,
boolean resultOnMissingExtension)
Create new
KeyUsageExtension instance using provided int flag. |
KeyUsageExtension(KeyUsage keyUsageValue)
Create new
KeyUsageExtension instance using provided single key usage enum value. |
KeyUsageExtension(KeyUsage keyUsageValue,
boolean resultOnMissingExtension)
Create new
KeyUsageExtension instance using provided single key usage enum value. |
KeyUsageExtension(List<KeyUsage> keyUsages)
Create new
KeyUsageExtension instance using provided key usage enum list. |
KeyUsageExtension(List<KeyUsage> keyUsages,
boolean resultOnMissingExtension)
Create new
KeyUsageExtension instance using provided key usage enum list. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
existsInCertificate(X509Certificate certificate)
Check if this extension is present in the provided certificate.
|
String |
getMessage()
Returns a message with extra information about the check.
|
equals, getExtensionOid, getExtensionValue, hashCodepublic static final String EXPECTED_VALUE
public static final String ACTUAL_VALUE
public static final String MISSING_VALUE
public KeyUsageExtension(int keyUsage)
KeyUsageExtension instance using provided int flag.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 bytepublic KeyUsageExtension(int keyUsage,
boolean resultOnMissingExtension)
KeyUsageExtension instance using provided int flag.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 byteresultOnMissingExtension - parameter which represents return value for
existsInCertificate(X509Certificate) method in case of the extension not being present in a certificatepublic KeyUsageExtension(List<KeyUsage> keyUsages)
KeyUsageExtension instance using provided key usage enum list.keyUsages - key usages List which represents key usage valuespublic KeyUsageExtension(List<KeyUsage> keyUsages, boolean resultOnMissingExtension)
KeyUsageExtension instance using provided key usage enum list.keyUsages - key usages List which represents key usage valuesresultOnMissingExtension - parameter which represents return value for
existsInCertificate(X509Certificate) method in case of the extension not being present in a certificatepublic KeyUsageExtension(KeyUsage keyUsageValue)
KeyUsageExtension instance using provided single key usage enum value.keyUsageValue - KeyUsage which represents single key usage enum valuepublic KeyUsageExtension(KeyUsage keyUsageValue, boolean resultOnMissingExtension)
KeyUsageExtension instance using provided single key usage enum value.keyUsageValue - KeyUsage which represents single key usage enum valueresultOnMissingExtension - parameter which represents return value for
existsInCertificate(X509Certificate) method in case of the extension not being present in a certificatepublic boolean existsInCertificate(X509Certificate certificate)
KeyUsageExtension,
check if this key usage bit values are present in certificate. Other values may be present as well.existsInCertificate in class CertificateExtensioncertificate - X509Certificate in which this extension shall be presenttrue if this key usage bit values are present in certificate, false otherwisepublic String getMessage()
CertificateExtensiongetMessage in class CertificateExtensionCopyright © 1998–2025 Apryse Group NV. All rights reserved.