Bouncy Castle Cryptography Library 1.45

## org.bouncycastle.jce.examples
Class PKCS12Example

    java.lang.Object
      org.bouncycastle.jce.examples.PKCS12Example

    public class PKCS12Example

extends java.lang.Object

Example of how to set up a certificiate chain and a PKCS 12 store for a private individual - obviously you'll need to generate your own keys, and you may need to add a NetscapeCertType extension or add a key usage extension depending on your application, but you should get the idea! As always this is just an example...

Constructor Summary
`PKCS12Example()`

Method Summary
`static java.security.cert.Certificate` `createCert(java.security.PublicKey pubKey, java.security.PrivateKey caPrivKey, java.security.PublicKey caPubKey)` we generate a certificate signed by our CA's intermediate certficate
`static java.security.cert.Certificate` `createIntermediateCert(java.security.PublicKey pubKey, java.security.PrivateKey caPrivKey, java.security.cert.X509Certificate caCert)` we generate an intermediate certificate signed by our CA
`static java.security.cert.Certificate` `createMasterCert(java.security.PublicKey pubKey, java.security.PrivateKey privKey)` we generate the CA's certificate
`static void` `main(java.lang.String[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PKCS12Example

    public PKCS12Example()

Method Detail

### createMasterCert

    public static java.security.cert.Certificate createMasterCert(java.security.PublicKey pubKey,
                                                                  java.security.PrivateKey privKey)
                                                           throws java.lang.Exception

  we generate the CA's certificate

  Throws:
    `java.lang.Exception`

### createIntermediateCert

    public static java.security.cert.Certificate createIntermediateCert(java.security.PublicKey pubKey,
                                                                        java.security.PrivateKey caPrivKey,
                                                                        java.security.cert.X509Certificate caCert)
                                                                 throws java.lang.Exception

  we generate an intermediate certificate signed by our CA

  Throws:
    `java.lang.Exception`

### createCert

    public static java.security.cert.Certificate createCert(java.security.PublicKey pubKey,
                                                            java.security.PrivateKey caPrivKey,
                                                            java.security.PublicKey caPubKey)
                                                     throws java.lang.Exception

  we generate a certificate signed by our CA's intermediate certficate

  Throws:
    `java.lang.Exception`

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

Bouncy Castle Cryptography Library 1.45