Class WeakCipher
This API provides access to Deprecated algorithms.
See Cipher for full documentation. WeakCipher is simply a drop-in replacement that only supports
deprecated algorithms and key lengths. This is helpful when you need to deal with weak algorithms for backward
compatibility purposes, but Cipher should always be used for new development and for anything intended to be secure.
Note: this class handles sensitive security-related data. Pay special attention to PCI DSS v3 requirements 2,
4, and 12.
Constant Summary
Constant Description CHAR_ENCODING : String = “UTF8”Strings containing keys, plain texts, cipher texts etc.
Constructor Summary
Method Summary
Method Description decryptBytes (Bytes , KeyRef , String , String , Number )Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the decryption. decryptBytes (Bytes , String , String , String , Number )Lower-level decryption API. decryptBytes (Bytes , KeyRef , String , String , Number )Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the decryption. decryptBytes (Bytes , String , String , String , Number )Lower-level decryption API. decryptBytes (Bytes , KeyRef , String , String , Number )Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the decryption. decryptBytes (Bytes , String , String , String , Number )Lower-level decryption API. decrypt (String , KeyRef , String , String , Number )Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the keystore for the decryption. decrypt (String , String , String , String , Number )Decrypts the message using the given parameters. decrypt (String , KeyRef , String , String , Number )Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the keystore for the decryption. decrypt (String , String , String , String , Number )Decrypts the message using the given parameters. decrypt (String , KeyRef , String , String , Number )Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the keystore for the decryption. decrypt (String , String , String , String , Number )Decrypts the message using the given parameters. encryptBytes (Bytes , CertificateRef , String , String , Number )Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the encryption. encryptBytes (Bytes , String , String , String , Number )Lower-level encryption API. encryptBytes (Bytes , CertificateRef , String , String , Number )Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the encryption. encryptBytes (Bytes , String , String , String , Number )Lower-level encryption API. encryptBytes (Bytes , CertificateRef , String , String , Number )Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows to use a key in the keystore for the encryption. encryptBytes (Bytes , String , String , String , Number )Lower-level encryption API. encrypt (String , CertificateRef , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. encrypt (String , String , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. encrypt (String , CertificateRef , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. encrypt (String , String , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. encrypt (String , CertificateRef , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters. encrypt (String , String , String , String , Number )Encrypt the passed message by using the specified key and applying the transformations described by the specified parameters.
Methods inherited from class Object
assign , create , create , defineProperties , defineProperty , entries , freeze , fromEntries , getOwnPropertyDescriptor , getOwnPropertyNames , getOwnPropertySymbols , getPrototypeOf , hasOwnProperty , is , isExtensible , isFrozen , isPrototypeOf , isSealed , keys , preventExtensions , propertyIsEnumerable , seal , setPrototypeOf , toLocaleString , toString , valueOf , values
Constant Details
CHAR_ENCODING
CHAR_ENCODING: String = "UTF8"
Strings containing keys, plain texts, cipher texts etc. are internally
converted into byte arrays using this encoding (currently UTF8).
Constructor Details
WeakCipher()
WeakCipher()
Method Details
decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 1
decryptBytes(encryptedBytes: Bytes , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in
the keystore for the decryption. See Cipher.decryptBytes(Bytes, KeyRef, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
privateKey - A reference to a private key in the key store.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
decryptBytes(Bytes, String, String, String, Number) - Variant 1
decryptBytes(encryptedBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See Cipher.decryptBytes(Bytes, String, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
key - The key to use for decryption.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
See Also:
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 2
decryptBytes(encryptedBytes: Bytes , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in
the keystore for the decryption. See Cipher.decryptBytes(Bytes, KeyRef, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
privateKey - A reference to a private key in the key store.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
decryptBytes(Bytes, String, String, String, Number) - Variant 2
decryptBytes(encryptedBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See Cipher.decryptBytes(Bytes, String, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
key - The key to use for decryption.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
See Also:
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
decryptBytes(Bytes, KeyRef, String, String, Number) - Variant 3
decryptBytes(encryptedBytes: Bytes , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to decryptBytes(Bytes, String, String, String, Number) , which allows to use a key in
the keystore for the decryption. See Cipher.decryptBytes(Bytes, KeyRef, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
privateKey - A reference to a private key in the key store.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
API Version:
Available from version 16.2.
Does not use a default initialization vector.
decryptBytes(Bytes, String, String, String, Number) - Variant 3
decryptBytes(encryptedBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level decryption API. Decrypts the passed bytes using the specified
key and applying the transformations described by the specified
parameters. See Cipher.decryptBytes(Bytes, String, String, String, Number) for full
documentation.
Parameters:
encryptedBytes - The bytes to decrypt.
key - The key to use for decryption.
transformation - The transformation used to originally encrypt.
saltOrIV - the salt or IV to use.
iterations - the iterations to use.
Returns:
See Also:
API Version:
Available from version 16.2.
Does not use a default initialization vector.
decrypt(String, KeyRef, String, String, Number) - Variant 1
decrypt(base64Msg: String , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): String
Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the
keystore for the decryption. See Cipher.decrypt(String, KeyRef, String, String, Number) for full
documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
privateKey - A reference to a private key in the key store.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
decrypt(String, String, String, String, Number) - Variant 1
decrypt(base64Msg: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Decrypts the message using the given parameters. See
Cipher.decrypt(String, String, String, String, Number) for full documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
key - The decryption key
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
decrypt(String, KeyRef, String, String, Number) - Variant 2
decrypt(base64Msg: String , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): String
Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the
keystore for the decryption. See Cipher.decrypt(String, KeyRef, String, String, Number) for full
documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
privateKey - A reference to a private key in the key store.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
decrypt(String, String, String, String, Number) - Variant 2
decrypt(base64Msg: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Decrypts the message using the given parameters. See
Cipher.decrypt(String, String, String, String, Number) for full documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
key - The decryption key
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
decrypt(String, KeyRef, String, String, Number) - Variant 3
decrypt(base64Msg: String , privateKey: KeyRef , transformation: String , saltOrIV: String , iterations: Number ): String
Alternative method to decrypt(String, String, String, String, Number) , which allows using a key in the
keystore for the decryption. See Cipher.decrypt(String, KeyRef, String, String, Number) for full
documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
privateKey - A reference to a private key in the key store.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
Available from version 16.2.
Does not use a default initialization vector.
decrypt(String, String, String, String, Number) - Variant 3
decrypt(base64Msg: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Decrypts the message using the given parameters. See
Cipher.decrypt(String, String, String, String, Number) for full documentation.
Parameters:
base64Msg - the base64 encoded data to decrypt
key - The decryption key
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
the original plaintext message.
API Version:
Available from version 16.2.
Does not use a default initialization vector.
encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 1
encryptBytes(messageBytes: Bytes , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows
to use a key in the keystore for the encryption. See Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number) for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
publicKey - A reference to a public key
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
encryptBytes(Bytes, String, String, String, Number) - Variant 1
encryptBytes(messageBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See Cipher.encryptBytes(Bytes, String, String, String, Number)
for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
key - The key to use for encryption.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 2
encryptBytes(messageBytes: Bytes , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows
to use a key in the keystore for the encryption. See Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number) for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
publicKey - A reference to a public key.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
encryptBytes(Bytes, String, String, String, Number) - Variant 2
encryptBytes(messageBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See Cipher.encryptBytes(Bytes, String, String, String, Number)
for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
key - The key to use for encryption.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
encryptBytes(Bytes, CertificateRef, String, String, Number) - Variant 3
encryptBytes(messageBytes: Bytes , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Alternative method to encryptBytes(Bytes, String, String, String, Number) , which allows
to use a key in the keystore for the encryption. See Cipher.encryptBytes(Bytes, CertificateRef, String, String, Number) for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
publicKey - A reference to a public key.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
Available from version 16.2.
Does not use a default initialization vector.
encryptBytes(Bytes, String, String, String, Number) - Variant 3
encryptBytes(messageBytes: Bytes , key: String , transformation: String , saltOrIV: String , iterations: Number ): Bytes
Lower-level encryption API. Encrypts the passed bytes by using the specified key and applying the transformations
described by the specified parameters. See Cipher.encryptBytes(Bytes, String, String, String, Number)
for full documentation.
Parameters:
messageBytes - The bytes to encrypt.
key - The key to use for encryption.
transformation - Transformation in "algorithm/mode/padding" format.
saltOrIV - Initialization value appropriate for the algorithm.
iterations - The number of passes to make when turning a passphrase into a key.
Returns:
See Also:
API Version:
Available from version 16.2.
Does not use a default initialization vector.
encrypt(String, CertificateRef, String, String, Number) - Variant 1
encrypt(message: String , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, CertificateRef, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
publicKey - A reference to a public key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
encrypt(String, String, String, String, Number) - Variant 1
encrypt(message: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, String, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
key - Key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
No longer available as of version 15.5.
Under some conditions this method allowed a non-Base64 encrypted value for the salt parameter.
encrypt(String, CertificateRef, String, String, Number) - Variant 2
encrypt(message: String , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, CertificateRef, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
publicKey - A reference to a public key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
encrypt(String, String, String, String, Number) - Variant 2
encrypt(message: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, String, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
key - Key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
Available from version 15.5.
No longer available as of version 16.2.
Requires Base64-encryption for the salt parameter.
encrypt(String, CertificateRef, String, String, Number) - Variant 3
encrypt(message: String , publicKey: CertificateRef , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, CertificateRef, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
publicKey - A reference to a public key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
Available from version 16.2.
Does not use a default initialization vector.
encrypt(String, String, String, String, Number) - Variant 3
encrypt(message: String , key: String , transformation: String , saltOrIV: String , iterations: Number ): String
Encrypt the passed message by using the specified key and applying the
transformations described by the specified parameters.
See Cipher.encrypt(String, String, String, String, Number) for full documentation.
Parameters:
message - Message to encrypt (this will be converted to UTF-8 first)
key - Key
transformation - Transformation in "algorithm/mode/padding" format
saltOrIV - Initialization value appropriate for the algorithm
iterations - The number of passes to make when turning a passphrase into a key, if applicable
Returns:
Base64-encoded encrypted data
API Version:
Available from version 16.2.
Does not use a default initialization vector.