demo.x509
Class CertificateExtensions

java.lang.Object
  |
  +--demo.x509.CertificateExtensions

public class CertificateExtensions
extends Object

This class tests the several implemented X509v3 certificate extensions.

The following X509v3 extensions are implemented (and tested by this class):

To avoid the time consuming process of key creation, the issuer certificate and private key are read in from a keystore "jce.keystore" located in the current working directory (if it yet not does exist, please run SetupKeyStore for creating it.

Version:
File Revision 26

Constructor Summary
CertificateExtensions()
           
 
Method Summary
 X509Certificate createCertificate(Name subject, PublicKey pk, Name issuer, PrivateKey sk, AlgorithmID algorithm, String fileName, int serialNumber, V3Extension[] extensions)
          Creates a certificate according to the X.509 Notation and subsequently saves the certifcate to a specified file.
static void main(String[] argv)
          Starts the X509v3 extensions test procedure.
 void start()
          Creates a new self-signed X509v3 certificate with a lot of extensions.
 void start(String fileName)
          Creates a new self-signed X509v3 certificate with a lot of extensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertificateExtensions

public CertificateExtensions()
Method Detail

createCertificate

public X509Certificate createCertificate(Name subject,
                                         PublicKey pk,
                                         Name issuer,
                                         PrivateKey sk,
                                         AlgorithmID algorithm,
                                         String fileName,
                                         int serialNumber,
                                         V3Extension[] extensions)
                                  throws Exception
Creates a certificate according to the X.509 Notation and subsequently saves the certifcate to a specified file.

Depending on the subject ID either a self-signed CA certificate will be created or a user certificate. If the extensions parameter is set to true, SubjectKeyIdentifier, KeyUsage, and BasicConstraints extensions will be added to the new certifcate.

Parameters:
subject - the user demanding the certificate (may be the certification authority itself)
pk - the subject´s public key to be certified
issuer - the certification authority that issues the certificate
sk - the issuer´s private key for signing the certificate
algorithm - the ID of the signature algorithm
extensions - a boolean value indicating if there are any extending informations
fileName - the name of the file to which the certificate shall be saved
serialNumber - the serial number of the certifcate to be created
extensions - an array of X509v3 extensions to be added to the certificate
Returns:
the certificate just created

start

public void start()
Creates a new self-signed X509v3 certificate with a lot of extensions.

To avoid the time consuming process of key creation, the issuer certificate and private key are created from a PEM encoded file "caRSA.pem" located in a "test" directory. Run the CreateCertificates demo for creating the required structures and saving them to the file requested above, if it yet not exist.


start

public void start(String fileName)
Creates a new self-signed X509v3 certificate with a lot of extensions.

To avoid the time consuming process of key creation, the issuer certificate and private key are created from a PEM encoded file "caRSA.pem" located in a "test" directory. Run the CreateCertificates demo for creating the required structures and saving them to the file requested above, if it yet not exist.

Parameters:
fileName - the name to which to write the cert

main

public static void main(String[] argv)
Starts the X509v3 extensions test procedure.

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