SymmetricDecrypt
PowerScript function
Description
Decrypts a blob value using symmetric algorithm.
Applies to
CrypterObject objects
Syntax
|
1 |
crypter.SymmetricDecrypt ( algorithm, variable, key{, operationmode{, iv{, padding}}}) |
|
Argument |
Description |
|---|---|
|
crypter |
The name of the CrypterObject object. |
|
algorithm |
A value of the SymmetricAlgorithm enumerated type that Values are:
|
|
variable |
A blob whose value is the data you want to decrypt with When using the system blob function to convert a string to |
|
key |
A blob specifying the secret key. The length of the secret key can be 128 bits, 192 bits, The length of the secret key must be 64 bits with The length of the secret key can be 128 bits, 192 bits The length of the secret key must be 192 bits with The length of the secret key can be 32 bits~448 bits with |
|
operationmode (optional) |
A value of the OperationMode enumerated type that Values are:
|
|
iv (optional) |
A blob specifying the initialization vector. Zeros filled |
|
padding (optional) |
A value of the PaddingScheme enumerated type that Values are:
ZerosPadding!, PKCSPadding!, and OneAndZerosPadding! can |
Return value
Blob.
Returns the result of the decrypt if it succeeds. If any argument’s
value is null, the method returns null. If an error occurs, throw the
exception.
Examples
The following statements encrypt the data using AES and then decrypt
the data using AES.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Blob lblb_data Blob lblb_key Blob lblb_iv Blob lblb_encrypt Blob lblb_decrypt lblb_data = Blob("Test AES", EncodingANSI!) lblb_key = Blob("Test Key12345678", EncodingANSI!) lblb_iv = Blob("Test IV 12345678", EncodingANSI!) CrypterObject lnv_CrypterObject lnv_CrypterObject = Create CrypterObject // Encrypt data using AES lblb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, lblb_data, lblb_key, & OperationModeCBC!, lblb_iv, PKCSPadding!) // Decrypt data using AES lblb_decrypt = lnv_CrypterObject.SymmetricDecrypt(AES!, lblb_encrypt, lblb_key, & OperationModeCBC!, lblb_iv, PKCSPadding!) messagebox("SymmetricDecrypt", string(lblb_decrypt, EncodingANSI!)) |
See also