iaik.me.security
Class PBE
java.lang.Object
|
+--iaik.me.security.PBE
- public class PBE
- extends Object
Password based encryption and MAC functionality.
Method Summary |
ASN1 |
getASN1()
|
static Cipher |
getCipher(ASN1 algId,
char[] password)
|
Cipher |
getCipher(int mode,
char[] password,
byte[] salt,
int iterationCount,
SecureRandom random)
Returns the corresponding PBE cipher. |
static PBE |
getInstance(String oid)
|
static PBE |
getInstance(String algorithm,
int kdf,
int keyLength,
int ivLength,
byte[] iv)
Returns a PBE cipher.
if algorithm is null, the Triples DES cipher will be used. |
int |
getIterationCount()
|
static Mac |
getMac(ASN1 algId,
char[] password)
|
Mac |
getMac(char[] password,
byte[] salt,
int iterationCount,
SecureRandom random)
|
byte[] |
getSalt()
Returns the salt the was used for the last key derivation operation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OID_PKCS12_DES_EDE_168_SHA
public static final String OID_PKCS12_DES_EDE_168_SHA
OID_PKCS12_RC2_40_SHA
public static final String OID_PKCS12_RC2_40_SHA
OID_PKCS5V1_DES_MD5
public static final String OID_PKCS5V1_DES_MD5
OID_PKCS5_PBES2
public static final String OID_PKCS5_PBES2
KDF_PKCS5V1
public static final int KDF_PKCS5V1
KDF_PKCS5V2
public static final int KDF_PKCS5V2
KDF_PKCS12
public static final int KDF_PKCS12
IV_PASSWORD_BASED
public static final int IV_PASSWORD_BASED
IV_RANDOM
public static final int IV_RANDOM
getCipher
public Cipher getCipher(int mode,
char[] password,
byte[] salt,
int iterationCount,
SecureRandom random)
throws CryptoException
- Returns the corresponding PBE cipher.
- Parameters:
mode
- password
- salt
- iterationCount
- random
- - Returns:
-
- Throws:
CryptoException
-
getMac
public Mac getMac(char[] password,
byte[] salt,
int iterationCount,
SecureRandom random)
throws CryptoException
getSalt
public byte[] getSalt()
- Returns the salt the was used for the last key derivation operation. If no salt was specified prior to invoking the
getCipher(int, char[], byte[], int, iaik.me.security.SecureRandom)
or getMac(char[], byte[], int, iaik.me.security.SecureRandom)
method,
the salt is chosen randomly.
- Returns:
- array of bytes containing the salt value
getIterationCount
public int getIterationCount()
getASN1
public ASN1 getASN1()
throws CryptoException
getInstance
public static PBE getInstance(String oid)
throws CryptoException
getInstance
public static PBE getInstance(String algorithm,
int kdf,
int keyLength,
int ivLength,
byte[] iv)
- Returns a PBE cipher.
if algorithm is null, the Triples DES cipher will be used.
- Parameters:
algorithm
- kdf
- defines which derivation function to use,keyLength
- ivLength
- iv
- IV for the cipher- Returns:
- an initializes PBE cipher
getCipher
public static Cipher getCipher(ASN1 algId,
char[] password)
throws CryptoException,
IOException
getMac
public static Mac getMac(ASN1 algId,
char[] password)
throws CryptoException,
IOException
IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC