[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [java-sec] PKCS12 Certificates



Hi Guarav,

On Tue, 17 Apr 2001, Gaurav Banerjee (CTS) wrote:

> hi all,
> I just had a question. I am able to generate PKCS12 Certificates in the
> format of .p12 /.pfx using the KeyTool. is there any programmatic way to
> generate such certificates.? Are there any API's which would enable me to
> programmatically generate PKCS12 Certificates ?
> 
> 

Sure - just use JCSI's pkcs12 implementation of java.security.KeyStore
See

  http://java.sun.com/products/jdk/1.2/docs/api/java/security/KeyStore.html

To create a new KeyStore from scratch, just pass in "null" for the
initial InputStream and password.

    keystore = KeyStore.getInstance("pkcs12");
    keystore.load(null,null);

    // Load up your KeyStore with certs and keys
    .....

    // Save KeyStore to a pkcs12 file
    FileOutputStream fos = new FileOutputStream("store.p12");
    keystore.store(fos, "password".toCharArray());


cheers,
Tim




java-sec mailing list archive
Date Index | Thread Index | Security Group home page