com.ibm.security.certclient.util
Class PkCASetUp
- java.lang.Object
-
- com.ibm.security.certclient.util.PkCASetUp
-
- All Implemented Interfaces:
- com.ibm.security.certclient.base.PkAttrKind, com.ibm.security.certclient.base.PkCertConstants, com.ibm.security.certclient.base.PkConstants, com.ibm.security.certclient.base.PkHttpConstants, com.ibm.security.certclient.base.PkPollConstants, com.ibm.security.certclient.base.PkRevoConstants
public class PkCASetUp extends Object implements com.ibm.security.certclient.base.PkConstants
This utility class generates and maintains a key-pair and a self-signed certificate to go with it.
-
-
Field Summary
Fields Modifier and Type Field and Description static intCAstatic intCA_ALLstatic intCERTstatic intCRLstatic intSERVER-
Fields inherited from interface com.ibm.security.certclient.base.PkConstants
BIG_ONE, BIG_TWO, DEFAULT_KEY_SIZE, DEFAULT_LIFETIME, DEFAULT_PROVIDER, DEFAULT_RNG, DSA_KEY_TYPE, EC_KEY_TYPE, MD2_WITH_RSA, MD5_WITH_RSA, PKI_DB_CONN, PKI_DB_CONNS, PKI_ISSUER_DN, PKI_ISSUER_HOST, PKI_ISSUER_PORT, PKI_OPER, PKI_ROOT, RSA_KEY_TYPE, SHA1_WITH_DSA, SHA1_WITH_ECDSA, SHA1_WITH_RSA, SHA2_WITH_ECDSA, SHA3_WITH_ECDSA, SHA3_WITH_RSA, SHA5_WITH_ECDSA, SHA5_WITH_RSA
-
Fields inherited from interface com.ibm.security.certclient.base.PkAttrKind
ATTR_APPLIED, ATTR_APPROVED, ATTR_NAMES
-
Fields inherited from interface com.ibm.security.certclient.base.PkCertConstants
CERT_ALGORITHM_ID, CERT_ALGORITHM_NAME, CERT_ALTERNATIVE_NAME, CERT_AUTH_KEY_IDENTIFIER, CERT_BASIC_CONSTRAINTS, CERT_CA_PUBS, CERT_CA_VENDOR, CERT_CMP_VERSION, CERT_CRL_DISTRIBUTION_POINTS, CERT_EXT, CERT_EXT_KEY_USAGE, CERT_HIERARCHICAL, CERT_INIT_PWD, CERT_ISSUER, CERT_ISSUER_ID, CERT_KEY, CERT_KEY_IDENTIFIER, CERT_KEY_TYPE, CERT_KEY_USAGE, CERT_MESSAGE_PROTECTED, CERT_MESSAGE_PROTECTION_ALGORITHM_ID, CERT_MESSAGE_PROTECTION_ALGORITHM_NAME, CERT_MESSAGE_PROTECTION_KEY, CERT_MESSAGE_PROTECTION_PWD, CERT_NAME_CONSTRAINTS, CERT_NETSCAPE_CERT_TYPE, CERT_NOT_AFTER, CERT_NOT_BEFORE, CERT_OPER, CERT_OUTFILENAME, CERT_POLICY_CONSTRAINTS, CERT_POLICY_MAPPINGS, CERT_PRIVATE_KEY, CERT_PRIVATE_KEY_EE, CERT_PRIVATE_KEY_USAGE, CERT_PROVIDER, CERT_PUBLISH_IMMEDIATELY, CERT_RECIPIENT_DN, CERT_REP_HDR, CERT_REQ_ID, CERT_REVO_PUBLIC_KEY, CERT_REVOCATION_PASSPHRASE, CERT_ROOT, CERT_SENDER_KID, CERT_SERIAL_NUMBER, CERT_SUBJECT, CERT_SUBJECT_ALTERNATIVE_NAME, CERT_SUBJECT_ID, CERT_TIME_TO_CHECK_BACK, CERT_VENDOR_TPKI_RA_ENROLL, CERT_VERSION, CERT_VERSION_1, CERT_VERSION_2, CERT_VERSION_3, CERT_X509, KEY_STORE_CERT_ALIAS, KEY_STORE_ENTRY_PWD, KEY_STORE_INIT_CERT_ALIAS, KEY_STORE_INIT_ENTRY_PWD, MAKE_CONF_REQUEST_MESSAGE, MAX_SUBJECT_NAME_LENGTH_TO_STORE_IN_TABLES, sccsid
-
Fields inherited from interface com.ibm.security.certclient.base.PkRevoConstants
REVO_BAD_SINCE_DATE, REVO_CRL_EXT, REVO_OPER, REVO_PUBLISH_IMMEDIATELY, REVO_REASON, REVO_ROOT
-
-
Constructor Summary
Constructors Constructor and Description PkCASetUp(String name, String keyType, String sigAlg, int keyBits, long validity, String keyUsageType)Creates a key-pair and self-signed certificate object for a particular key type and signature algorithm.PkCASetUp(String name, String keyType, String sigAlg, int keyBits, long validity, String[] keyUsageType, String providerName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static byte[]computeKID(PublicKey key, boolean shortValue)X509CertificategetCertificate()PrivateKeygetPrivateKey()StringgetSigAlg()voidkeyPairGenerate(String keyType, int keyBits, String providerName)X509Certificaterecertify(X509Certificate b, int certType, PrivateKey pKey, Date notBefore, Date notAfter, String providerName)
-
-
-
Field Detail
-
CERT
public static final int CERT
- See Also:
- Constant Field Values
-
SERVER
public static final int SERVER
- See Also:
- Constant Field Values
-
CRL
public static final int CRL
- See Also:
- Constant Field Values
-
CA
public static final int CA
- See Also:
- Constant Field Values
-
CA_ALL
public static final int CA_ALL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PkCASetUp
public PkCASetUp(String name, String keyType, String sigAlg, int keyBits, long validity, String keyUsageType) throws GeneralSecurityException, IOException, com.ibm.security.certclient.base.PkException
Creates a key-pair and self-signed certificate object for a particular key type and signature algorithm.- Parameters:
name- the x500 name to use for the self-signed certificatekeyType- type of key, e.g. "RSA", "DSA"sigAlg- name of the signature algorithm, e.g. "MD5WithRSA", "MD2WithRSA", "SHAwithDSA"keyBits- key size for generated key-pairvalidity- certificate validity in seconds- Throws:
GeneralSecurityExceptionIOExceptioncom.ibm.security.certclient.base.PkException
-
PkCASetUp
public PkCASetUp(String name, String keyType, String sigAlg, int keyBits, long validity, String[] keyUsageType, String providerName) throws GeneralSecurityException, IOException, com.ibm.security.certclient.base.PkException
- Throws:
GeneralSecurityExceptionIOExceptioncom.ibm.security.certclient.base.PkException
-
-
Method Detail
-
getPrivateKey
public PrivateKey getPrivateKey()
-
getCertificate
public X509Certificate getCertificate()
-
getSigAlg
public String getSigAlg()
-
computeKID
public static byte[] computeKID(PublicKey key, boolean shortValue) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
recertify
public X509Certificate recertify(X509Certificate b, int certType, PrivateKey pKey, Date notBefore, Date notAfter, String providerName) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
keyPairGenerate
public void keyPairGenerate(String keyType, int keyBits, String providerName) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
-