IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.keystore
Class CMSKeyStore

java.lang.Object
  extended by demo.keystore.CMSKeyStore
All Implemented Interfaces:
CMSKeyStoreConstants

public class CMSKeyStore
extends java.lang.Object
implements CMSKeyStoreConstants

KeyStore repository used providing keys and certificates for the several CMS and S/MIME demos.

Reads and loads keys and certificates from an IaikKeyStore files and provides methods to access the keys and certificates based on algorithm name and algorithm type.


Field Summary
static iaik.x509.X509Certificate[] ca_certificates
          Ca certificates.
static java.security.PrivateKey[] ca_keys
          Ca keys.
static java.lang.Object[][] certificates
          Certificates.
static int DSA
           
static int ESDH
           
static java.security.PrivateKey[][] keys
          Keys.
static java.lang.String ks_filename
          The KeyStore file name.
static int RSA
          Indices into the cert/key tables
static int RSAPSS
           
static int SSDH
           
static int SZ_1024_SIGN
           
static int SZ_2048_CRYPT_1
           
static int SZ_2048_CRYPT_2
           
static int SZ_2048_CRYPT_3
           
static int SZ_2048_SHA1_SIGN
           
static int SZ_2048_SHA256_SIGN
           
static int SZ_2048_SHA384_SIGN
           
static int SZ_2048_SHA512_SIGN
           
static int SZ_2048_SIGN_1
           
static int SZ_2048_SIGN_2
           
static int SZ_2048_SIGN_3
           
static int SZ_3072_SIGN
           
 
Fields inherited from interface demo.keystore.CMSKeyStoreConstants
CA_DSA, CA_RSA, CA_RSAPSS, DSA_1024, DSA_2048, DSA_3072, ESDH_2048_1, ESDH_2048_2, KS_DIRECTORY, KS_FILENAME, KS_PASSWORD, RSA_2048_CRYPT_1, RSA_2048_CRYPT_2, RSA_2048_CRYPT_3, RSA_2048_SIGN_1, RSA_2048_SIGN_2, RSA_2048_SIGN_3, RSAPSS_2048_SHA1_SIGN, RSAPSS_2048_SHA256_SIGN, RSAPSS_2048_SHA384_SIGN, RSAPSS_2048_SHA512_SIGN, SSDH_2048_1, SSDH_2048_2, TSP_SERVER
 
Constructor Summary
CMSKeyStore()
           
 
Method Summary
static void addRecipientKey(java.security.PrivateKey recipientKey, iaik.x509.X509Certificate[] recipientCertChain)
          Adds a key and certificate by its key (certificate) ids to the given recipient keys/certs repositories.
static iaik.x509.X509Certificate getCaCertificate(int type)
          Returns a demo CA certificate.
static java.security.PrivateKey getCaPrivateKey(int type)
          Returns the private key of a CA certificate.
static iaik.x509.X509Certificate[] getCertificateChain(int type, int size)
          Returns a demo user certificate.
static java.security.PrivateKey getPrivateKey(int type, int size)
          Returns the private key of a CA certificate.
static iaik.x509.X509Certificate getRecipientCert(iaik.cms.CertificateIdentifier certId)
          Gets a recipient cert by the given certificate id from the given recipient certs repository.
static java.security.PrivateKey getRecipientKey(iaik.cms.KeyIdentifier keyId)
          Gets a recipient key by the given key (certificate) id.
static iaik.x509.X509Certificate[] getTspServerCertificate()
          Returns the certificate chain of the TSP demo server.
static java.security.PrivateKey getTspServerPrivateKey()
          Returns the private key of the TSP demo server.
static void initKeyStore()
          Initializes the keystore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

certificates

public static java.lang.Object[][] certificates
Certificates.


keys

public static java.security.PrivateKey[][] keys
Keys.


ca_certificates

public static iaik.x509.X509Certificate[] ca_certificates
Ca certificates.


ca_keys

public static java.security.PrivateKey[] ca_keys
Ca keys.


RSA

public static final int RSA
Indices into the cert/key tables

See Also:
Constant Field Values

DSA

public static final int DSA
See Also:
Constant Field Values

RSAPSS

public static final int RSAPSS
See Also:
Constant Field Values

ESDH

public static final int ESDH
See Also:
Constant Field Values

SSDH

public static final int SSDH
See Also:
Constant Field Values

SZ_1024_SIGN

public static final int SZ_1024_SIGN
See Also:
Constant Field Values

SZ_2048_SIGN_1

public static final int SZ_2048_SIGN_1
See Also:
Constant Field Values

SZ_2048_SIGN_2

public static final int SZ_2048_SIGN_2
See Also:
Constant Field Values

SZ_2048_SIGN_3

public static final int SZ_2048_SIGN_3
See Also:
Constant Field Values

SZ_3072_SIGN

public static final int SZ_3072_SIGN
See Also:
Constant Field Values

SZ_2048_CRYPT_1

public static final int SZ_2048_CRYPT_1
See Also:
Constant Field Values

SZ_2048_CRYPT_2

public static final int SZ_2048_CRYPT_2
See Also:
Constant Field Values

SZ_2048_CRYPT_3

public static final int SZ_2048_CRYPT_3
See Also:
Constant Field Values

SZ_2048_SHA1_SIGN

public static final int SZ_2048_SHA1_SIGN
See Also:
Constant Field Values

SZ_2048_SHA256_SIGN

public static final int SZ_2048_SHA256_SIGN
See Also:
Constant Field Values

SZ_2048_SHA384_SIGN

public static final int SZ_2048_SHA384_SIGN
See Also:
Constant Field Values

SZ_2048_SHA512_SIGN

public static final int SZ_2048_SHA512_SIGN
See Also:
Constant Field Values

ks_filename

public static java.lang.String ks_filename
The KeyStore file name.

Constructor Detail

CMSKeyStore

public CMSKeyStore()
Method Detail

addRecipientKey

public static void addRecipientKey(java.security.PrivateKey recipientKey,
                                   iaik.x509.X509Certificate[] recipientCertChain)
Adds a key and certificate by its key (certificate) ids to the given recipient keys/certs repositories.

Parameters:
recipientKey - the recipient key to be added
recipientCertChain - the recipient certificate chain

getRecipientKey

public static java.security.PrivateKey getRecipientKey(iaik.cms.KeyIdentifier keyId)
Gets a recipient key by the given key (certificate) id.

Parameters:
keyId - the key identifier
Returns:
the recipient key or null if no key for the given id can be found

getRecipientCert

public static iaik.x509.X509Certificate getRecipientCert(iaik.cms.CertificateIdentifier certId)
Gets a recipient cert by the given certificate id from the given recipient certs repository.

Parameters:
certId - the certificate identifier
Returns:
the recipient cert or null if no cert for the given id can be found

initKeyStore

public static void initKeyStore()
Initializes the keystore.


getPrivateKey

public static java.security.PrivateKey getPrivateKey(int type,
                                                     int size)
Returns the private key of a CA certificate.

Parameters:
type - RSA or DSA or ESDH
size - the key size
Returns:
the key

getCertificateChain

public static iaik.x509.X509Certificate[] getCertificateChain(int type,
                                                              int size)
Returns a demo user certificate.

Parameters:
type - RSA or DSA or ESDH or SSDH
size - the size of the corresponding key
Returns:
the certificate chain

getCaPrivateKey

public static java.security.PrivateKey getCaPrivateKey(int type)
Returns the private key of a CA certificate.

Parameters:
type - RSA or DSA
Returns:
the key

getCaCertificate

public static iaik.x509.X509Certificate getCaCertificate(int type)
Returns a demo CA certificate.

Parameters:
type - RSA or DSA
Returns:
the ca certificate

getTspServerPrivateKey

public static java.security.PrivateKey getTspServerPrivateKey()
Returns the private key of the TSP demo server.

Returns:
the key

getTspServerCertificate

public static iaik.x509.X509Certificate[] getTspServerCertificate()
Returns the certificate chain of the TSP demo server.

Returns:
the tsp server certificate

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC