org.mozilla.jss.crypto

Class PBEAlgorithm

public class PBEAlgorithm extends KeyGenAlgorithm

Algorithms that can be used for generating symmetric keys from passwords.
Field Summary
static PBEAlgorithmPBE_MD2_DES_CBC
static PBEAlgorithmPBE_MD5_DES_CBC
static PBEAlgorithmPBE_SHA1_DES3_CBC
static PBEAlgorithmPBE_SHA1_DES_CBC
static PBEAlgorithmPBE_SHA1_RC2_128_CBC
static PBEAlgorithmPBE_SHA1_RC2_40_CBC
static PBEAlgorithmPBE_SHA1_RC4_128
static PBEAlgorithmPBE_SHA1_RC4_40
Constructor Summary
protected PBEAlgorithm(int oidTag, String name, int validStrength, OBJECT_IDENTIFIER oid, EncryptionAlgorithm encAlg, int saltLength)
Method Summary
EncryptionAlgorithmgetEncryptionAlg()
Returns the EncryptionAlgorithm that should be used with keys generated with this PBEAlgorithm.
intgetSaltLength()
Returns the number of bytes of salt that should be supplied when generating keys with this algorithm.

Field Detail

PBE_MD2_DES_CBC

public static final PBEAlgorithm PBE_MD2_DES_CBC

PBE_MD5_DES_CBC

public static final PBEAlgorithm PBE_MD5_DES_CBC

PBE_SHA1_DES3_CBC

public static final PBEAlgorithm PBE_SHA1_DES3_CBC

PBE_SHA1_DES_CBC

public static final PBEAlgorithm PBE_SHA1_DES_CBC

PBE_SHA1_RC2_128_CBC

public static final PBEAlgorithm PBE_SHA1_RC2_128_CBC

PBE_SHA1_RC2_40_CBC

public static final PBEAlgorithm PBE_SHA1_RC2_40_CBC

PBE_SHA1_RC4_128

public static final PBEAlgorithm PBE_SHA1_RC4_128

PBE_SHA1_RC4_40

public static final PBEAlgorithm PBE_SHA1_RC4_40

Constructor Detail

PBEAlgorithm

protected PBEAlgorithm(int oidTag, String name, int validStrength, OBJECT_IDENTIFIER oid, EncryptionAlgorithm encAlg, int saltLength)

Method Detail

getEncryptionAlg

public EncryptionAlgorithm getEncryptionAlg()
Returns the EncryptionAlgorithm that should be used with keys generated with this PBEAlgorithm. For example, PBE_MD2_DES_CBC.getEncryptionAlg() returns EncryptionAlgorithm.DES_CBC.

getSaltLength

public int getSaltLength()
Returns the number of bytes of salt that should be supplied when generating keys with this algorithm.

PKCS #5 algorithms require exactly 8 bytes of salt. PKCS #12 algorithms take a variable length, but recommend that the salt length be at least as long as the output of the hash function. For SHA-1, the output length is 20 bytes.