Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.26
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 modify the 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 AuthorityKeyIdentifier` | `createAuthorityKeyId(java.security.PublicKey pubKey)`
`static AuthorityKeyIdentifier` | `createAuthorityKeyId(java.security.PublicKey pubKey, X509Name name, int sNumber)`
`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.PublicKey caPubKey)` 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 SubjectKeyIdentifier` | `createSubjectKeyId(java.security.PublicKey pubKey)`
`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

### createSubjectKeyId

    public static SubjectKeyIdentifier createSubjectKeyId(java.security.PublicKey pubKey)

### createAuthorityKeyId

    public static AuthorityKeyIdentifier createAuthorityKeyId(java.security.PublicKey pubKey,
                                                              X509Name name,
                                                              int sNumber)

### createAuthorityKeyId

    public static AuthorityKeyIdentifier createAuthorityKeyId(java.security.PublicKey pubKey)

### 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.PublicKey caPubKey)
                                                                 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.26
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD