org.mozilla.jss.crypto

Class EncryptionAlgorithm

public class EncryptionAlgorithm extends Algorithm

An algorithm for performing symmetric encryption.
Nested Class Summary
static classEncryptionAlgorithm.Alg
static classEncryptionAlgorithm.Mode
static classEncryptionAlgorithm.Padding
Field Summary
static EncryptionAlgorithmAES_128_CBC
static EncryptionAlgorithmAES_128_CBC_PAD
static EncryptionAlgorithmAES_128_ECB
static EncryptionAlgorithmAES_192_CBC
static EncryptionAlgorithmAES_192_CBC_PAD
static EncryptionAlgorithmAES_192_ECB
static EncryptionAlgorithmAES_256_CBC
static EncryptionAlgorithmAES_256_CBC_PAD
static EncryptionAlgorithmAES_256_ECB
static EncryptionAlgorithmAES_CBC_PAD
static OBJECT_IDENTIFIERAES_ROOT_OID
static EncryptionAlgorithmDES3_CBC
static EncryptionAlgorithmDES3_CBC_PAD
static EncryptionAlgorithmDES3_ECB
static EncryptionAlgorithmDES_CBC
static EncryptionAlgorithmDES_CBC_PAD
static EncryptionAlgorithmDES_ECB
static EncryptionAlgorithmRC2_CBC
static EncryptionAlgorithmRC2_CBC_PAD
static EncryptionAlgorithmRC4
Constructor Summary
protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class paramClass, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength)
protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class[] paramClasses, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength)
Method Summary
static EncryptionAlgorithmfromOID(OBJECT_IDENTIFIER oid)
static EncryptionAlgorithmfromString(String name)
EncryptionAlgorithm.AlggetAlg()
Returns the base algorithm, without the parameters.
intgetBlockSize()
The blocksize of the algorithm in bytes.
intgetIVLength()
Returns the number of bytes that this algorithm expects in its initialization vector.
intgetKeyStrength()
Returns the key strength of this algorithm in bits.
EncryptionAlgorithm.ModegetMode()
Returns the mode of this algorithm.
EncryptionAlgorithm.PaddinggetPadding()
Returns the padding type of this algorithm.
EncryptionAlgorithm.PaddinggetPaddingType()
Returns the type of padding for this algorithm.
booleanisPadded()
Returns true if this algorithm performs padding.
static EncryptionAlgorithmlookup(String algName, String modeName, String paddingName, int keyStrength)

Field Detail

AES_128_CBC

public static final EncryptionAlgorithm AES_128_CBC

AES_128_CBC_PAD

public static final EncryptionAlgorithm AES_128_CBC_PAD

AES_128_ECB

public static final EncryptionAlgorithm AES_128_ECB

AES_192_CBC

public static final EncryptionAlgorithm AES_192_CBC

AES_192_CBC_PAD

public static final EncryptionAlgorithm AES_192_CBC_PAD

AES_192_ECB

public static final EncryptionAlgorithm AES_192_ECB

AES_256_CBC

public static final EncryptionAlgorithm AES_256_CBC

AES_256_CBC_PAD

public static final EncryptionAlgorithm AES_256_CBC_PAD

AES_256_ECB

public static final EncryptionAlgorithm AES_256_ECB

AES_CBC_PAD

public static final EncryptionAlgorithm AES_CBC_PAD

AES_ROOT_OID

public static final OBJECT_IDENTIFIER AES_ROOT_OID

DES3_CBC

public static final EncryptionAlgorithm DES3_CBC

DES3_CBC_PAD

public static final EncryptionAlgorithm DES3_CBC_PAD

DES3_ECB

public static final EncryptionAlgorithm DES3_ECB

DES_CBC

public static final EncryptionAlgorithm DES_CBC

DES_CBC_PAD

public static final EncryptionAlgorithm DES_CBC_PAD

DES_ECB

public static final EncryptionAlgorithm DES_ECB

RC2_CBC

public static final EncryptionAlgorithm RC2_CBC

RC2_CBC_PAD

public static final EncryptionAlgorithm RC2_CBC_PAD

RC4

public static final EncryptionAlgorithm RC4

Constructor Detail

EncryptionAlgorithm

protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class paramClass, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength)

EncryptionAlgorithm

protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class[] paramClasses, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength)

Method Detail

fromOID

public static EncryptionAlgorithm fromOID(OBJECT_IDENTIFIER oid)

fromString

public static EncryptionAlgorithm fromString(String name)

Deprecated: This method is deprecated because algorithm strings don't contain key length, which is necessary to distinguish between AES algorithms.

getAlg

public EncryptionAlgorithm.Alg getAlg()
Returns the base algorithm, without the parameters. For example, the base algorithm of "AES/CBC/NoPadding" is "AES".

getBlockSize

public int getBlockSize()
The blocksize of the algorithm in bytes. Stream algorithms (such as RC4) have a blocksize of 1.

getIVLength

public int getIVLength()
Returns the number of bytes that this algorithm expects in its initialization vector.

Returns: The size in bytes of the IV for this algorithm. A size of 0 means this algorithm does not take an IV.

getKeyStrength

public int getKeyStrength()
Returns the key strength of this algorithm in bits. Algorithms that use continuously variable key sizes (such as RC4) will return 0 to indicate they can use any key size.

getMode

public EncryptionAlgorithm.Mode getMode()
Returns the mode of this algorithm.

getPadding

public EncryptionAlgorithm.Padding getPadding()
Returns the padding type of this algorithm.

getPaddingType

public EncryptionAlgorithm.Padding getPaddingType()
Returns the type of padding for this algorithm.

isPadded

public boolean isPadded()

Deprecated: Call getPaddingType() instead.

Returns true if this algorithm performs padding.

lookup

public static EncryptionAlgorithm lookup(String algName, String modeName, String paddingName, int keyStrength)