Package org.wildfly.security.x500
Class X500
- java.lang.Object
-
- org.wildfly.security.x500.X500
-
public final class X500 extends Object
Useful X500 constants and utilities.- Author:
- David M. Lloyd
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description private
X500()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static X509Certificate[]
asOrderedX509CertificateChain(PublicKey firstPublicKey, Certificate[] certificates)
Convert an unordered array of certificates into an ordered X.509 certificate chain.static X509Certificate[]
asX509CertificateArray(Object[] certificates)
Convert an array into aX509Certificate[]
.private static boolean
createX509CertificateChain(X509Certificate firstCertificate, ArrayList<X509Certificate> certificateChain, HashMap<Principal,HashSet<X509Certificate>> certificatesMap)
static X509Certificate[]
createX509CertificateChain(X509Certificate firstCertificate, HashMap<Principal,HashSet<X509Certificate>> certificatesMap)
Create an X.509 certificate chain given the first certificate that should be in the chain and a map of certificates.private static boolean
issuedBy(X509Certificate certificate, X509Certificate issuer)
private static void
swapCertificates(Certificate[] certificates, int i, int j)
-
-
-
Field Detail
-
NO_CERTIFICATES
public static final X509Certificate[] NO_CERTIFICATES
A constant array containing zero certificates.
-
OID_AT
public static final String OID_AT
- See Also:
- Constant Field Values
-
OID_AT_COMMON_NAME
public static final String OID_AT_COMMON_NAME
- See Also:
- Constant Field Values
-
OID_AT_SURNAME
public static final String OID_AT_SURNAME
- See Also:
- Constant Field Values
-
OID_AT_SERIAL_NUMBER
public static final String OID_AT_SERIAL_NUMBER
- See Also:
- Constant Field Values
-
OID_AT_COUNTRY_NAME
public static final String OID_AT_COUNTRY_NAME
- See Also:
- Constant Field Values
-
OID_AT_LOCALITY_NAME
public static final String OID_AT_LOCALITY_NAME
- See Also:
- Constant Field Values
-
OID_AT_STATE_OR_PROVINCE_NAME
public static final String OID_AT_STATE_OR_PROVINCE_NAME
- See Also:
- Constant Field Values
-
OID_AT_STREET_ADDRESS
public static final String OID_AT_STREET_ADDRESS
- See Also:
- Constant Field Values
-
OID_AT_ORGANIZATION_NAME
public static final String OID_AT_ORGANIZATION_NAME
- See Also:
- Constant Field Values
-
OID_AT_ORGANIZATIONAL_UNIT_NAME
public static final String OID_AT_ORGANIZATIONAL_UNIT_NAME
- See Also:
- Constant Field Values
-
OID_AT_TITLE
public static final String OID_AT_TITLE
- See Also:
- Constant Field Values
-
OID_AT_DESCRIPTION
public static final String OID_AT_DESCRIPTION
- See Also:
- Constant Field Values
-
OID_AT_BUSINESS_CATEGORY
public static final String OID_AT_BUSINESS_CATEGORY
- See Also:
- Constant Field Values
-
OID_AT_TELEPHONE_NUMBER
public static final String OID_AT_TELEPHONE_NUMBER
- See Also:
- Constant Field Values
-
OID_AT_FAX_NUMBER
public static final String OID_AT_FAX_NUMBER
- See Also:
- Constant Field Values
-
OID_AT_NAME
public static final String OID_AT_NAME
- See Also:
- Constant Field Values
-
OID_AT_GIVEN_NAME
public static final String OID_AT_GIVEN_NAME
- See Also:
- Constant Field Values
-
OID_AT_INITIALS
public static final String OID_AT_INITIALS
- See Also:
- Constant Field Values
-
OID_AT_GENERATION_QUALIFIER
public static final String OID_AT_GENERATION_QUALIFIER
- See Also:
- Constant Field Values
-
OID_AT_DN_QUALIFIER
public static final String OID_AT_DN_QUALIFIER
- See Also:
- Constant Field Values
-
OID_AT_HOUSE_IDENTIFIER
public static final String OID_AT_HOUSE_IDENTIFIER
- See Also:
- Constant Field Values
-
OID_AT_PSEUDONYM
public static final String OID_AT_PSEUDONYM
- See Also:
- Constant Field Values
-
OID_UID
public static final String OID_UID
- See Also:
- Constant Field Values
-
OID_DC
public static final String OID_DC
- See Also:
- Constant Field Values
-
OID_CE
public static final String OID_CE
- See Also:
- Constant Field Values
-
OID_CE_SUBJECT_DIRECTORY_ATTRIBUTES
public static final String OID_CE_SUBJECT_DIRECTORY_ATTRIBUTES
- See Also:
- Constant Field Values
-
OID_CE_SUBJECT_KEY_IDENTIFIER
public static final String OID_CE_SUBJECT_KEY_IDENTIFIER
- See Also:
- Constant Field Values
-
OID_CE_KEY_USAGE
public static final String OID_CE_KEY_USAGE
- See Also:
- Constant Field Values
-
OID_CE_PRIVATE_KEY_USAGE_PERIOD
public static final String OID_CE_PRIVATE_KEY_USAGE_PERIOD
- See Also:
- Constant Field Values
-
OID_CE_SUBJECT_ALT_NAME
public static final String OID_CE_SUBJECT_ALT_NAME
- See Also:
- Constant Field Values
-
OID_CE_ISSUER_ALT_NAME
public static final String OID_CE_ISSUER_ALT_NAME
- See Also:
- Constant Field Values
-
OID_CE_BASIC_CONSTRAINTS
public static final String OID_CE_BASIC_CONSTRAINTS
- See Also:
- Constant Field Values
-
OID_CE_CRL_NUMBER
public static final String OID_CE_CRL_NUMBER
- See Also:
- Constant Field Values
-
OID_CE_CRL_REASONS
public static final String OID_CE_CRL_REASONS
- See Also:
- Constant Field Values
-
OID_CE_HOLD_INSTRUCTION_CODE
public static final String OID_CE_HOLD_INSTRUCTION_CODE
- See Also:
- Constant Field Values
-
OID_CE_INVALIDITY_DATE
public static final String OID_CE_INVALIDITY_DATE
- See Also:
- Constant Field Values
-
OID_CE_DELTA_CLR_INDICATOR
public static final String OID_CE_DELTA_CLR_INDICATOR
- See Also:
- Constant Field Values
-
OID_CE_ISSUING_DISTRIBUTION_POINT
public static final String OID_CE_ISSUING_DISTRIBUTION_POINT
- See Also:
- Constant Field Values
-
OID_CE_CERTIFICATE_ISSUER
public static final String OID_CE_CERTIFICATE_ISSUER
- See Also:
- Constant Field Values
-
OID_CE_NAME_CONSTRAINTS
public static final String OID_CE_NAME_CONSTRAINTS
- See Also:
- Constant Field Values
-
OID_CE_CRL_DISTRIBUTION_POINTS
public static final String OID_CE_CRL_DISTRIBUTION_POINTS
- See Also:
- Constant Field Values
-
OID_CE_CERTIFICATE_POLICIES
public static final String OID_CE_CERTIFICATE_POLICIES
- See Also:
- Constant Field Values
-
OID_CE_POLICY_MAPPINGS
public static final String OID_CE_POLICY_MAPPINGS
- See Also:
- Constant Field Values
-
OID_CE_AUTHORITY_KEY_IDENTIFIER
public static final String OID_CE_AUTHORITY_KEY_IDENTIFIER
- See Also:
- Constant Field Values
-
OID_CE_POLICY_CONSTRAINTS
public static final String OID_CE_POLICY_CONSTRAINTS
- See Also:
- Constant Field Values
-
OID_CE_EXT_KEY_USAGE
public static final String OID_CE_EXT_KEY_USAGE
- See Also:
- Constant Field Values
-
OID_CE_FRESHEST_CRL
public static final String OID_CE_FRESHEST_CRL
- See Also:
- Constant Field Values
-
OID_CE_INHIBIT_ANY_POLICY
public static final String OID_CE_INHIBIT_ANY_POLICY
- See Also:
- Constant Field Values
-
OID_PKIX
public static final String OID_PKIX
- See Also:
- Constant Field Values
-
OID_PE
public static final String OID_PE
- See Also:
- Constant Field Values
-
OID_QT
public static final String OID_QT
- See Also:
- Constant Field Values
-
OID_KP
public static final String OID_KP
- See Also:
- Constant Field Values
-
OID_AD
public static final String OID_AD
- See Also:
- Constant Field Values
-
OID_PE_AUTHORITY_INFO_ACCESS
public static final String OID_PE_AUTHORITY_INFO_ACCESS
- See Also:
- Constant Field Values
-
OID_PE_SUBJECT_INFO_ACCESS
public static final String OID_PE_SUBJECT_INFO_ACCESS
- See Also:
- Constant Field Values
-
OID_QT_CPS
public static final String OID_QT_CPS
- See Also:
- Constant Field Values
-
OID_QT_UNOTICE
public static final String OID_QT_UNOTICE
- See Also:
- Constant Field Values
-
OID_KP_SERVER_AUTH
public static final String OID_KP_SERVER_AUTH
- See Also:
- Constant Field Values
-
OID_KP_CLIENT_AUTH
public static final String OID_KP_CLIENT_AUTH
- See Also:
- Constant Field Values
-
OID_KP_CODE_SIGNING
public static final String OID_KP_CODE_SIGNING
- See Also:
- Constant Field Values
-
OID_KP_EMAIL_PROTECTION
public static final String OID_KP_EMAIL_PROTECTION
- See Also:
- Constant Field Values
-
OID_KP_TIME_STAMPING
public static final String OID_KP_TIME_STAMPING
- See Also:
- Constant Field Values
-
OID_KP_OCSP_SIGNING
public static final String OID_KP_OCSP_SIGNING
- See Also:
- Constant Field Values
-
OID_AD_OCSP
public static final String OID_AD_OCSP
- See Also:
- Constant Field Values
-
OID_AD_CA_ISSUERS
public static final String OID_AD_CA_ISSUERS
- See Also:
- Constant Field Values
-
OID_AD_TIME_STAMPING
public static final String OID_AD_TIME_STAMPING
- See Also:
- Constant Field Values
-
OID_AD_CA_REPOSITORY
public static final String OID_AD_CA_REPOSITORY
- See Also:
- Constant Field Values
-
OID_HOLD_INSTRUCTION
public static final String OID_HOLD_INSTRUCTION
- See Also:
- Constant Field Values
-
OID_HOLD_INSTRUCTION_NONE
@Deprecated public static final String OID_HOLD_INSTRUCTION_NONE
Deprecated.- See Also:
- Constant Field Values
-
OID_HOLD_INSTRUCTION_CALL_ISSUER
public static final String OID_HOLD_INSTRUCTION_CALL_ISSUER
- See Also:
- Constant Field Values
-
OID_HOLD_INSTRUCTION_REJECT
public static final String OID_HOLD_INSTRUCTION_REJECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
asX509CertificateArray
public static X509Certificate[] asX509CertificateArray(Object[] certificates) throws ArrayStoreException
Convert an array into aX509Certificate[]
.- Parameters:
certificates
- the certificates (may not benull
)- Returns:
- the X.509 certificate array (not
null
) - Throws:
ArrayStoreException
- if one of the certificates in the array is not anX509Certificate
-
asOrderedX509CertificateChain
public static X509Certificate[] asOrderedX509CertificateChain(PublicKey firstPublicKey, Certificate[] certificates) throws IllegalArgumentException
Convert an unordered array of certificates into an ordered X.509 certificate chain.- Parameters:
firstPublicKey
- the public key that should be in the first certificate in the ordered X.509 certificate chain (may not benull
)certificates
- the unordered array of certificates (may not benull
)- Returns:
- the ordered X.509 certificate chain, as an array
- Throws:
IllegalArgumentException
- if the given unordered array of certificates cannot be converted into an ordered X.509 certificate chain
-
createX509CertificateChain
public static X509Certificate[] createX509CertificateChain(X509Certificate firstCertificate, HashMap<Principal,HashSet<X509Certificate>> certificatesMap) throws IllegalArgumentException
Create an X.509 certificate chain given the first certificate that should be in the chain and a map of certificates.- Parameters:
firstCertificate
- the certificate that should be first in the newly created X.509 certificate chaincertificatesMap
- a map of distinguished names to certificates to use to create the X.509 certificate chain- Returns:
- the newly created X.509 certificate chain, as an array
- Throws:
IllegalArgumentException
- if the X.509 certificate chain could not be created
-
swapCertificates
private static void swapCertificates(Certificate[] certificates, int i, int j)
-
issuedBy
private static boolean issuedBy(X509Certificate certificate, X509Certificate issuer)
-
createX509CertificateChain
private static boolean createX509CertificateChain(X509Certificate firstCertificate, ArrayList<X509Certificate> certificateChain, HashMap<Principal,HashSet<X509Certificate>> certificatesMap)
-
-