public class SetupCMSEccKeyStore extends java.lang.Object implements CMSEccKeyStoreConstants
CMSEccKeyStoreConstants
.CMSEccKeyStoreConstants
,
CMSEccKeyStore
CA_ECDSA, ECDH_192_1, ECDH_192_2, ECDH_224_1, ECDH_224_2, ECDH_256_1, ECDH_256_2, ECDH_384_1, ECDH_384_2, ECDH_521_1, ECDH_521_2, ECDH_BRAINPOOL_192_1, ECDH_BRAINPOOL_192_2, ECDH_BRAINPOOL_224_1, ECDH_BRAINPOOL_224_2, ECDH_BRAINPOOL_256_1, ECDH_BRAINPOOL_256_2, ECDH_BRAINPOOL_384_1, ECDH_BRAINPOOL_384_2, ECDH_BRAINPOOL_512_1, ECDH_BRAINPOOL_512_2, ECDH_X25519, ECDH_X448, ECDSA_192, ECDSA_224, ECDSA_256, ECDSA_384, ECDSA_521, ECDSA_BRAINPOOL_192, ECDSA_BRAINPOOL_224, ECDSA_BRAINPOOL_256, ECDSA_BRAINPOOL_384, ECDSA_BRAINPOOL_512, EDDSA_ED25519, EDDSA_ED448, KS_DIRECTORY, KS_FILENAME, KS_PASSWORD
Constructor and Description |
---|
SetupCMSEccKeyStore()
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addToKeyStore(java.security.KeyPair keyPair,
iaik.x509.X509Certificate[] chain,
java.lang.String alias)
Adds the private key and the certificate chain to the key store.
|
static iaik.x509.X509Certificate |
createCertificate(iaik.asn1.structures.Name subject,
java.security.PublicKey publicKey,
iaik.asn1.structures.Name issuer,
java.security.PrivateKey privateKey,
iaik.asn1.structures.AlgorithmID algorithm,
byte[] keyID,
boolean forSigning)
Creates a certificate from the given values.
|
void |
generateCertificates()
Generates the certificates.
|
static java.security.KeyPair |
generateEccKeyPair(java.lang.String algorithm,
java.lang.String curveName)
Generates an ECC key pair for a curve with a certain name
|
java.security.KeyPair |
generateKeyPair(java.lang.String algorithm,
int bitLength)
Generates a key pair for a curve with a certain name
|
static void |
main(java.lang.String[] arg)
Creates the test certificates.
|
static void |
start()
Starts the keystore setup.
|
public SetupCMSEccKeyStore()
public java.security.KeyPair generateKeyPair(java.lang.String algorithm, int bitLength) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
algorithm
- the key algorithmbitLength
- the length of the key (in bits).java.security.NoSuchAlgorithmException
- if ECDSA KeyPairGenerator is not availablejava.security.NoSuchProviderException
- if provider IAIK_ECC is not installedpublic static java.security.KeyPair generateEccKeyPair(java.lang.String algorithm, java.lang.String curveName) throws java.lang.Exception
algorithm
- the key algorithmcurveName
- the name of the curve to be used.java.lang.Exception
- if the KeyPair cannot be generatedpublic static iaik.x509.X509Certificate createCertificate(iaik.asn1.structures.Name subject, java.security.PublicKey publicKey, iaik.asn1.structures.Name issuer, java.security.PrivateKey privateKey, iaik.asn1.structures.AlgorithmID algorithm, byte[] keyID, boolean forSigning)
subject
- the subject of the certificatepublicKey
- the public key to includeissuer
- the issuer of the certificateprivateKey
- the private key for signing the certificatealgorithm
- the signature algorithm to usekeyID
- the key id for the AuthotityKeyIdentifier extensionforSigning
- if the certificate to be created shall be used for signing or encryptionpublic void addToKeyStore(java.security.KeyPair keyPair, iaik.x509.X509Certificate[] chain, java.lang.String alias) throws java.security.KeyStoreException
keyPair
- the key pair with the private key to be addedchain
- the certificate chain to be addedalias
- the alias for the keystore entryjava.security.KeyStoreException
- if an error occurs when trying to add the keypublic void generateCertificates()
public static void start()
public static void main(java.lang.String[] arg) throws java.io.IOException
java.io.IOException