iaik.me.keymgmt
Class EncryptedPrivateKey

java.lang.Object
  |
  +--iaik.me.keymgmt.EncryptedPrivateKey

public class EncryptedPrivateKey
extends Object

A PKCS#8 EncryptedPrivateKeyInfo. This class allows import and export of those keys. Note that this class does not provide integrity protection and should consequently not be used on its own.

See Also:
KeyStore, PKCS12

Constructor Summary
EncryptedPrivateKey(ASN1 asn1)
          Parse an encrypted private key from its ASN1 structure.
EncryptedPrivateKey(InputStream in)
          Parse an encrypted private key from an InputStream.
 
Method Summary
 PrivateKey decrypt(char[] password)
          Decrypt the key using the given password and return it.
static ASN1 encrypt(PrivateKey key, char[] password, String algorithm, int iterationCount)
          Encrypt the given PrivateKey using password and parameters and return its ASN.1 structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptedPrivateKey

public EncryptedPrivateKey(InputStream in)
                    throws IOException
Parse an encrypted private key from an InputStream.

EncryptedPrivateKey

public EncryptedPrivateKey(ASN1 asn1)
                    throws IOException
Parse an encrypted private key from its ASN1 structure.
Method Detail

decrypt

public PrivateKey decrypt(char[] password)
                   throws CryptoException
Decrypt the key using the given password and return it. In case of an incorrect password or any other error a CryptoException is thrown.

encrypt

public static ASN1 encrypt(PrivateKey key,
                           char[] password,
                           String algorithm,
                           int iterationCount)
                    throws CryptoException
Encrypt the given PrivateKey using password and parameters and return its ASN.1 structure. If algorithm is null or iterationCount is 0 the PBE default values are used.
See Also:
PBE

This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note).

IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC