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 StringAD_CA_ISSUERSprivate static StringAD_CA_REPOSITORYprivate static StringAD_OCSPprivate static StringAD_TIME_STAMPINGprivate static String[]ALT_NAMES_TYPESprivate static StringBASIC_CONSTRAINTSprivate static StringCAprivate static StringCE_EXT_KEY_USAGEprivate static StringCE_ISSUER_ALT_NAMEprivate static StringCE_SUBJECT_ALT_NAMEprivate static int[]DELIMSprivate static StringDNSprivate static StringEMAILprivate static StringIPprivate static StringKEY_USAGEprivate static StringKP_CLIENT_AUTHprivate static StringKP_CODE_SIGNINGprivate static StringKP_EMAIL_PROTECTIONprivate static StringKP_OCSP_SIGNINGprivate static StringKP_SERVER_AUTHprivate static StringKP_TIME_STAMPINGprivate static StringOIDprivate static StringPATH_LENprivate static StringPE_AUTHORITY_INFO_ACCESSprivate static StringPE_SUBJECT_INFO_ACCESSprivate static StringURI
-
Constructor Summary
Constructors Constructor Description CertUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static AccessDescriptiongetAccessDescription(String methodAndTypeAndValue)private static List<AccessDescription>getAccessDescriptions(String extensionValue)private static GeneralNamegetGeneralName(String typeAndValue)private static List<GeneralName>getGeneralNames(String extensionValue)private static StringgetKeyValue(String requiredKey, String keyAndValue)static X509CertificateExtensiongetX509CertificateExtension(boolean critical, String extensionName, String extensionValue)Create anX509CertificateExtensionusing the given extension name and string value.private static booleanisDelim(int c, int... delims)private static StringoidFromKeyPurpose(String keyPurpose)private static StringoidFromMethod(String method)private static voidskipDelims(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 anX509CertificateExtensionusing 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 anX509CertificateExtensionfrom 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
-
-