demo.keystore
Class SetupKeyStore

java.lang.Object
  |
  +--demo.keystore.SetupKeyStore
All Implemented Interfaces:
KeyStoreConstants

public class SetupKeyStore
extends Object
implements KeyStoreConstants

Creates a default KeyStore in the current working directory. These keys are used by many demos included in IAIK-JCE. The aliases and the password for accessing the keys and certificates can be found in KeyStoreConstants.

Version:
File Revision 23
See Also:
KeyStoreConstants

Fields inherited from interface demo.keystore.KeyStoreConstants
CA_DSA, CA_RSA, DH_1024, DH_2048, DH_512, DSA_1024, DSA_2048, DSA_512, KS_FILENAME, KS_PASSWORD, RSA_1024, RSA_2048, RSA_512
 
Constructor Summary
SetupKeyStore()
           
 
Method Summary
 void addToKeyStore(KeyPair keyPair, X509Certificate[] chain, String alias)
          Add the private key and the certificate chain to the key store.
static X509Certificate createCertificate(Name subject, PublicKey publicKey, Name issuer, X509Certificate issuerCert, PrivateKey privateKey, AlgorithmID algorithm, V3Extension[] extensions)
          Creates a certificate from the given values.
 void generateCertificates()
           
static KeyPair generateKeyPair(String algorithm, int bits)
          Generate a KeyPair using the specified algorithm with the given size.
static void main(String[] arg)
          Creates the server and client certificates.
static void start()
           
static void start(boolean useCurrentDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetupKeyStore

public SetupKeyStore()
Method Detail

generateKeyPair

public static KeyPair generateKeyPair(String algorithm,
                                      int bits)
                               throws NoSuchAlgorithmException
Generate a KeyPair using the specified algorithm with the given size.
Parameters:
algorithm - the algorithm to use
bits - the length of the key (modulus) in bits
Returns:
the KeyPair

createCertificate

public static X509Certificate createCertificate(Name subject,
                                                PublicKey publicKey,
                                                Name issuer,
                                                X509Certificate issuerCert,
                                                PrivateKey privateKey,
                                                AlgorithmID algorithm,
                                                V3Extension[] extensions)
Creates a certificate from the given values.
Parameters:
subject - the subject of the certificate
publicKey - the public key to include
issuer - the issuer of the certificate
privateKey - the private key for signing the certificate
algorithm - the signature algorithm to use

addToKeyStore

public void addToKeyStore(KeyPair keyPair,
                          X509Certificate[] chain,
                          String alias)
                   throws KeyStoreException
Add the private key and the certificate chain to the key store.

generateCertificates

public void generateCertificates()

start

public static void start(boolean useCurrentDir)

start

public static void start()

main

public static void main(String[] arg)
                 throws IOException
Creates the server and client certificates.

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK