Package org.wildfly.security.x500.cert
Class CertUtil
- java.lang.Object
-
- org.wildfly.security.x500.cert.CertUtil
-
class CertUtil extends Object
A utility class with common methods used for generating certificate signing requests and self-signed certificates.- Since:
- 1.2.0
- Author:
- Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description private static String
AD_CA_ISSUERS
private static String
AD_CA_REPOSITORY
private static String
AD_OCSP
private static String
AD_TIME_STAMPING
private static String[]
ALT_NAMES_TYPES
private static String
BASIC_CONSTRAINTS
private static String
CA
private static String
CE_EXT_KEY_USAGE
private static String
CE_ISSUER_ALT_NAME
private static String
CE_SUBJECT_ALT_NAME
private static int[]
DELIMS
private static String
DNS
private static String
EMAIL
private static String
IP
private static String
KEY_USAGE
private static String
KP_CLIENT_AUTH
private static String
KP_CODE_SIGNING
private static String
KP_EMAIL_PROTECTION
private static String
KP_OCSP_SIGNING
private static String
KP_SERVER_AUTH
private static String
KP_TIME_STAMPING
private static String
OID
private static String
PATH_LEN
private static String
PE_AUTHORITY_INFO_ACCESS
private static String
PE_SUBJECT_INFO_ACCESS
private static String
URI
-
Constructor Summary
Constructors Constructor Description CertUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static AccessDescription
getAccessDescription(String methodAndTypeAndValue)
private static List<AccessDescription>
getAccessDescriptions(String extensionValue)
private static GeneralName
getGeneralName(String typeAndValue)
private static List<GeneralName>
getGeneralNames(String extensionValue)
private static String
getKeyValue(String requiredKey, String keyAndValue)
static X509CertificateExtension
getX509CertificateExtension(boolean critical, String extensionName, String extensionValue)
Create anX509CertificateExtension
using the given extension name and string value.private static boolean
isDelim(int c, int... delims)
private static String
oidFromKeyPurpose(String keyPurpose)
private static String
oidFromMethod(String method)
private static void
skipDelims(org.wildfly.common.iteration.CodePointIterator di, org.wildfly.common.iteration.CodePointIterator cpi, int... delims)
-
-
-
Field Detail
-
BASIC_CONSTRAINTS
private static final String BASIC_CONSTRAINTS
- See Also:
- Constant Field Values
-
KEY_USAGE
private static final String KEY_USAGE
- See Also:
- Constant Field Values
-
CE_EXT_KEY_USAGE
private static final String CE_EXT_KEY_USAGE
- See Also:
- Constant Field Values
-
CE_SUBJECT_ALT_NAME
private static final String CE_SUBJECT_ALT_NAME
- See Also:
- Constant Field Values
-
CE_ISSUER_ALT_NAME
private static final String CE_ISSUER_ALT_NAME
- See Also:
- Constant Field Values
-
PE_AUTHORITY_INFO_ACCESS
private static final String PE_AUTHORITY_INFO_ACCESS
- See Also:
- Constant Field Values
-
PE_SUBJECT_INFO_ACCESS
private static final String PE_SUBJECT_INFO_ACCESS
- See Also:
- Constant Field Values
-
CA
private static final String CA
- See Also:
- Constant Field Values
-
PATH_LEN
private static final String PATH_LEN
- See Also:
- Constant Field Values
-
KP_SERVER_AUTH
private static final String KP_SERVER_AUTH
- See Also:
- Constant Field Values
-
KP_CLIENT_AUTH
private static final String KP_CLIENT_AUTH
- See Also:
- Constant Field Values
-
KP_CODE_SIGNING
private static final String KP_CODE_SIGNING
- See Also:
- Constant Field Values
-
KP_EMAIL_PROTECTION
private static final String KP_EMAIL_PROTECTION
- See Also:
- Constant Field Values
-
KP_TIME_STAMPING
private static final String KP_TIME_STAMPING
- See Also:
- Constant Field Values
-
KP_OCSP_SIGNING
private static final String KP_OCSP_SIGNING
- See Also:
- Constant Field Values
-
AD_OCSP
private static final String AD_OCSP
- See Also:
- Constant Field Values
-
AD_CA_ISSUERS
private static final String AD_CA_ISSUERS
- See Also:
- Constant Field Values
-
AD_TIME_STAMPING
private static final String AD_TIME_STAMPING
- See Also:
- Constant Field Values
-
AD_CA_REPOSITORY
private static final String AD_CA_REPOSITORY
- See Also:
- Constant Field Values
-
EMAIL
private static final String EMAIL
- See Also:
- Constant Field Values
-
URI
private static final String URI
- See Also:
- Constant Field Values
-
DNS
private static final String DNS
- See Also:
- Constant Field Values
-
IP
private static final String IP
- See Also:
- Constant Field Values
-
OID
private static final String OID
- See Also:
- Constant Field Values
-
ALT_NAMES_TYPES
private static final String[] ALT_NAMES_TYPES
-
DELIMS
private static final int[] DELIMS
-
-
Method Detail
-
getX509CertificateExtension
public static X509CertificateExtension getX509CertificateExtension(boolean critical, String extensionName, String extensionValue) throws IllegalArgumentException
Create anX509CertificateExtension
using the given extension name and string value.- Parameters:
critical
- whether the extension should be marked as criticalextensionName
- the extension nameextensionValue
- the extension value, as a string- Returns:
- the newly created
X509CertificateExtension
- Throws:
IllegalArgumentException
- if the given extension name or value is invalid or if creating anX509CertificateExtension
from a string value is not supported for the given extension name
-
skipDelims
private static void skipDelims(org.wildfly.common.iteration.CodePointIterator di, org.wildfly.common.iteration.CodePointIterator cpi, int... delims) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
isDelim
private static boolean isDelim(int c, int... delims)
-
getKeyValue
private static String getKeyValue(String requiredKey, String keyAndValue) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getGeneralNames
private static List<GeneralName> getGeneralNames(String extensionValue) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getGeneralName
private static GeneralName getGeneralName(String typeAndValue) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getAccessDescriptions
private static List<AccessDescription> getAccessDescriptions(String extensionValue) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getAccessDescription
private static AccessDescription getAccessDescription(String methodAndTypeAndValue) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-