Package org.mozilla.jss.crypto
Class EncryptionAlgorithm
java.lang.Object
org.mozilla.jss.crypto.Algorithm
org.mozilla.jss.crypto.EncryptionAlgorithm
An algorithm for performing symmetric encryption.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final OBJECT_IDENTIFIERstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmstatic final EncryptionAlgorithmFields inherited from class org.mozilla.jss.crypto.Algorithm
CKM_AES_CBC, CKM_AES_CBC_PAD, CKM_AES_CMAC, CKM_AES_ECB, CKM_AES_KEY_GEN, CKM_AES_KEY_WRAP, CKM_AES_KEY_WRAP_KWP, CKM_AES_KEY_WRAP_PAD, CKM_DES_CBC_PAD, CKM_DES_KEY_GEN, CKM_DES3_CBC_PAD, CKM_DES3_ECB, CKM_DES3_KEY_GEN, CKM_DSA_KEY_PAIR_GEN, CKM_EC_KEY_PAIR_GEN, CKM_GENERIC_SECRET_KEY_GEN, CKM_NSS_AES_KEY_WRAP, CKM_NSS_AES_KEY_WRAP_PAD, CKM_NSS_SP800_108_COUNTER_KDF_DERIVE_DATA, CKM_NSS_SP800_108_DOUBLE_PIPELINE_KDF_DERIVE_DATA, CKM_NSS_SP800_108_FEEDBACK_KDF_DERIVE_DATA, CKM_PBA_SHA1_WITH_SHA1_HMAC, CKM_RC2_CBC_PAD, CKM_RC2_KEY_GEN, CKM_RC4_KEY_GEN, CKM_RSA_PKCS_KEY_PAIR_GEN, CKM_RSA_PKCS_OAEP, CKM_SHA_1_HMAC, CKM_SHA256_HMAC, CKM_SHA384_HMAC, CKM_SHA512_HMAC, CKM_SP800_108_COUNTER_KDF, CKM_SP800_108_DOUBLE_PIPELINE_KDF, CKM_SP800_108_FEEDBACK_KDF, oid, oidIndex, SEC_OID_AES_128_CBC, SEC_OID_AES_128_ECB, SEC_OID_AES_128_KEY_WRAP_KWP, SEC_OID_AES_192_CBC, SEC_OID_AES_192_ECB, SEC_OID_AES_192_KEY_WRAP_KWP, SEC_OID_AES_256_CBC, SEC_OID_AES_256_ECB, SEC_OID_AES_256_KEY_WRAP_KWP, SEC_OID_ANSIX9_DSA_SIGNATURE, SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST, SEC_OID_ANSIX962_EC_PUBLIC_KEY, SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE, SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE, SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE, SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE, SEC_OID_ANSIX962_ECDSA_SIGNATURE_SPECIFIED_DIGEST, SEC_OID_DES_CBC, SEC_OID_DES_ECB, SEC_OID_DES_EDE3_CBC, SEC_OID_HMAC_SHA1, SEC_OID_HMAC_SHA256, SEC_OID_HMAC_SHA384, SEC_OID_HMAC_SHA512, SEC_OID_MD2, SEC_OID_MD5, SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION, SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION, SEC_OID_PKCS1_RSA_ENCRYPTION, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC4, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC4, SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC, SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC, SEC_OID_PKCS5_PBE_WITH_SHA1_AND_DES_CBC, SEC_OID_PKCS5_PBES2, SEC_OID_PKCS5_PBKDF2, SEC_OID_PKCS5_PBMAC1, SEC_OID_RC2_CBC, SEC_OID_RC4, SEC_OID_SHA1, SEC_OID_SHA256, SEC_OID_SHA384, SEC_OID_SHA512 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?>[] paramClasses, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength) protectedEncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?>[] paramClasses, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength, String name) protectedEncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?> paramClass, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength) protectedEncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?> paramClass, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength, String name) -
Method Summary
Modifier and TypeMethodDescriptionstatic EncryptionAlgorithmfromOID(OBJECT_IDENTIFIER oid) static EncryptionAlgorithmfromString(String name) Deprecated.This method is deprecated because algorithm strings don't contain key length, which is necessary to distinguish between AES algorithms.getAlg()intintReturns the number of bytes that this algorithm expects in its initialization vector.intgetMode()booleanisPadded()static EncryptionAlgorithmMethods inherited from class org.mozilla.jss.crypto.Algorithm
getEnum, getParameterClass, getParameterClasses, isValidParameterObject, toOID, toString
-
Field Details
-
RC4
-
DES_ECB
-
DES_CBC
-
DES_CBC_PAD
-
DES3_ECB
-
DES3_CBC
-
DES3_CBC_PAD
-
RC2_CBC
-
RC2_CBC_PAD
-
AES_ROOT_OID
-
AES_128_ECB
-
AES_128_CBC
-
AES_128_CBC_PAD
-
AES_192_ECB
-
AES_192_CBC
-
AES_192_CBC_PAD
-
AES_256_ECB
-
AES_256_CBC
-
AES_CBC_PAD
-
AES_256_CBC_PAD
-
AES_128_KEY_WRAP_KWP
-
AES_192_KEY_WRAP_KWP
-
AES_256_KEY_WRAP_KWP
-
-
Constructor Details
-
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) -
EncryptionAlgorithm
protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?> paramClass, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength, String name) -
EncryptionAlgorithm
protected EncryptionAlgorithm(int oidTag, EncryptionAlgorithm.Alg alg, EncryptionAlgorithm.Mode mode, EncryptionAlgorithm.Padding padding, Class<?>[] paramClasses, int blockSize, OBJECT_IDENTIFIER oid, int keyStrength, String name)
-
-
Method Details
-
getAlg
- Returns:
- The base algorithm, without the parameters. For example, the base algorithm of "AES/CBC/NoPadding" is "AES".
-
getMode
- Returns:
- The mode of this algorithm.
-
getPadding
- Returns:
- The padding type of this algorithm.
-
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.
-
fromOID
- Throws:
NoSuchAlgorithmException
-
fromString
@Deprecated public static EncryptionAlgorithm fromString(String name) throws NoSuchAlgorithmException Deprecated.This method is deprecated because algorithm strings don't contain key length, which is necessary to distinguish between AES algorithms.- Parameters:
name- Algorithm name.- Returns:
- Encryption algorithm.
- Throws:
NoSuchAlgorithmException- If the algorithm is not found.
-
lookup
public static EncryptionAlgorithm lookup(String algName, String modeName, String paddingName, int keyStrength) throws NoSuchAlgorithmException - Throws:
NoSuchAlgorithmException
-
getBlockSize
public int getBlockSize()- Returns:
- The blocksize of the algorithm in bytes. Stream algorithms (such as RC4) have a blocksize of 1.
-
isPadded
public boolean isPadded()- Returns:
trueif this algorithm performs padding.
-
getPaddingType
- Returns:
- The type of padding for this algorithm.
-
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.
-