org.bouncycastle.jce.provider
Class JDKKeyStore

java.lang.Object
  extended by java.security.KeyStoreSpi
      extended by org.bouncycastle.jce.provider.JDKKeyStore
All Implemented Interfaces:
BCKeyStore
Direct Known Subclasses:
JDKKeyStore.BouncyCastleStore

public class JDKKeyStore
extends java.security.KeyStoreSpi
implements BCKeyStore


Nested Class Summary
static class JDKKeyStore.BouncyCastleStore
          the BouncyCastle store.
private  class JDKKeyStore.StoreEntry
           
 
Field Summary
(package private) static int CERTIFICATE
           
(package private) static int KEY
           
private static java.lang.String KEY_CIPHER
           
(package private) static int KEY_PRIVATE
           
(package private) static int KEY_PUBLIC
           
private static int KEY_SALT_SIZE
           
(package private) static int KEY_SECRET
           
private static int MIN_ITERATIONS
           
(package private) static int NULL
           
protected  java.security.SecureRandom random
           
(package private) static int SEALED
           
(package private) static int SECRET
           
private static java.lang.String STORE_CIPHER
           
private static int STORE_SALT_SIZE
           
private static int STORE_VERSION
           
protected  java.util.Hashtable table
           
 
Constructor Summary
JDKKeyStore()
           
 
Method Summary
private  java.security.cert.Certificate decodeCertificate(java.io.DataInputStream dIn)
           
private  java.security.Key decodeKey(java.io.DataInputStream dIn)
           
private  void encodeCertificate(java.security.cert.Certificate cert, java.io.DataOutputStream dOut)
           
private  void encodeKey(java.security.Key key, java.io.DataOutputStream dOut)
           
 java.util.Enumeration engineAliases()
           
 boolean engineContainsAlias(java.lang.String alias)
           
 void engineDeleteEntry(java.lang.String alias)
           
 java.security.cert.Certificate engineGetCertificate(java.lang.String alias)
           
 java.lang.String engineGetCertificateAlias(java.security.cert.Certificate cert)
           
 java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String alias)
           
 java.util.Date engineGetCreationDate(java.lang.String alias)
           
 java.security.Key engineGetKey(java.lang.String alias, char[] password)
           
 boolean engineIsCertificateEntry(java.lang.String alias)
           
 boolean engineIsKeyEntry(java.lang.String alias)
           
 void engineLoad(java.io.InputStream stream, char[] password)
           
 void engineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert)
           
 void engineSetKeyEntry(java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain)
           
 void engineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain)
           
 int engineSize()
           
 void engineStore(java.io.OutputStream stream, char[] password)
           
protected  boolean isSameAs(byte[] one, byte[] two)
           
protected  void loadStore(java.io.InputStream in)
           
protected  javax.crypto.Cipher makePBECipher(java.lang.String algorithm, int mode, char[] password, byte[] salt, int iterationCount)
           
protected  void saveStore(java.io.OutputStream out)
           
 void setRandom(java.security.SecureRandom rand)
          set the random source for the key store
 
Methods inherited from class java.security.KeyStoreSpi
engineEntryInstanceOf, engineGetEntry, engineLoad, engineSetEntry, engineStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE_VERSION

private static final int STORE_VERSION
See Also:
Constant Field Values

STORE_SALT_SIZE

private static final int STORE_SALT_SIZE
See Also:
Constant Field Values

STORE_CIPHER

private static final java.lang.String STORE_CIPHER
See Also:
Constant Field Values

KEY_SALT_SIZE

private static final int KEY_SALT_SIZE
See Also:
Constant Field Values

MIN_ITERATIONS

private static final int MIN_ITERATIONS
See Also:
Constant Field Values

KEY_CIPHER

private static final java.lang.String KEY_CIPHER
See Also:
Constant Field Values

NULL

static final int NULL
See Also:
Constant Field Values

CERTIFICATE

static final int CERTIFICATE
See Also:
Constant Field Values

KEY

static final int KEY
See Also:
Constant Field Values

SECRET

static final int SECRET
See Also:
Constant Field Values

SEALED

static final int SEALED
See Also:
Constant Field Values

KEY_PRIVATE

static final int KEY_PRIVATE
See Also:
Constant Field Values

KEY_PUBLIC

static final int KEY_PUBLIC
See Also:
Constant Field Values

KEY_SECRET

static final int KEY_SECRET
See Also:
Constant Field Values

table

protected java.util.Hashtable table

random

protected java.security.SecureRandom random
Constructor Detail

JDKKeyStore

public JDKKeyStore()
Method Detail

encodeCertificate

private void encodeCertificate(java.security.cert.Certificate cert,
                               java.io.DataOutputStream dOut)
                        throws java.io.IOException
Throws:
java.io.IOException

decodeCertificate

private java.security.cert.Certificate decodeCertificate(java.io.DataInputStream dIn)
                                                  throws java.io.IOException
Throws:
java.io.IOException

encodeKey

private void encodeKey(java.security.Key key,
                       java.io.DataOutputStream dOut)
                throws java.io.IOException
Throws:
java.io.IOException

decodeKey

private java.security.Key decodeKey(java.io.DataInputStream dIn)
                             throws java.io.IOException
Throws:
java.io.IOException

makePBECipher

protected javax.crypto.Cipher makePBECipher(java.lang.String algorithm,
                                            int mode,
                                            char[] password,
                                            byte[] salt,
                                            int iterationCount)
                                     throws java.io.IOException
Throws:
java.io.IOException

setRandom

public void setRandom(java.security.SecureRandom rand)
Description copied from interface: BCKeyStore
set the random source for the key store

Specified by:
setRandom in interface BCKeyStore

engineAliases

public java.util.Enumeration engineAliases()
Specified by:
engineAliases in class java.security.KeyStoreSpi

engineContainsAlias

public boolean engineContainsAlias(java.lang.String alias)
Specified by:
engineContainsAlias in class java.security.KeyStoreSpi

engineDeleteEntry

public void engineDeleteEntry(java.lang.String alias)
                       throws java.security.KeyStoreException
Specified by:
engineDeleteEntry in class java.security.KeyStoreSpi
Throws:
java.security.KeyStoreException

engineGetCertificate

public java.security.cert.Certificate engineGetCertificate(java.lang.String alias)
Specified by:
engineGetCertificate in class java.security.KeyStoreSpi

engineGetCertificateAlias

public java.lang.String engineGetCertificateAlias(java.security.cert.Certificate cert)
Specified by:
engineGetCertificateAlias in class java.security.KeyStoreSpi

engineGetCertificateChain

public java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String alias)
Specified by:
engineGetCertificateChain in class java.security.KeyStoreSpi

engineGetCreationDate

public java.util.Date engineGetCreationDate(java.lang.String alias)
Specified by:
engineGetCreationDate in class java.security.KeyStoreSpi

engineGetKey

public java.security.Key engineGetKey(java.lang.String alias,
                                      char[] password)
                               throws java.security.NoSuchAlgorithmException,
                                      java.security.UnrecoverableKeyException
Specified by:
engineGetKey in class java.security.KeyStoreSpi
Throws:
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException

engineIsCertificateEntry

public boolean engineIsCertificateEntry(java.lang.String alias)
Specified by:
engineIsCertificateEntry in class java.security.KeyStoreSpi

engineIsKeyEntry

public boolean engineIsKeyEntry(java.lang.String alias)
Specified by:
engineIsKeyEntry in class java.security.KeyStoreSpi

engineSetCertificateEntry

public void engineSetCertificateEntry(java.lang.String alias,
                                      java.security.cert.Certificate cert)
                               throws java.security.KeyStoreException
Specified by:
engineSetCertificateEntry in class java.security.KeyStoreSpi
Throws:
java.security.KeyStoreException

engineSetKeyEntry

public void engineSetKeyEntry(java.lang.String alias,
                              byte[] key,
                              java.security.cert.Certificate[] chain)
                       throws java.security.KeyStoreException
Specified by:
engineSetKeyEntry in class java.security.KeyStoreSpi
Throws:
java.security.KeyStoreException

engineSetKeyEntry

public void engineSetKeyEntry(java.lang.String alias,
                              java.security.Key key,
                              char[] password,
                              java.security.cert.Certificate[] chain)
                       throws java.security.KeyStoreException
Specified by:
engineSetKeyEntry in class java.security.KeyStoreSpi
Throws:
java.security.KeyStoreException

engineSize

public int engineSize()
Specified by:
engineSize in class java.security.KeyStoreSpi

isSameAs

protected boolean isSameAs(byte[] one,
                           byte[] two)

loadStore

protected void loadStore(java.io.InputStream in)
                  throws java.io.IOException
Throws:
java.io.IOException

saveStore

protected void saveStore(java.io.OutputStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

engineLoad

public void engineLoad(java.io.InputStream stream,
                       char[] password)
                throws java.io.IOException
Specified by:
engineLoad in class java.security.KeyStoreSpi
Throws:
java.io.IOException

engineStore

public void engineStore(java.io.OutputStream stream,
                        char[] password)
                 throws java.io.IOException
Specified by:
engineStore in class java.security.KeyStoreSpi
Throws:
java.io.IOException