SymmetricEncrypt
PowerScript function
Description
Encrypts a blob value using symmetric algorithm.
Applies to
CrypterObject objects
Syntax
|
1 |
crypter.SymmetricEncrypt ( 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 encrypt 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 encryption result (length: 24) 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 return the
encrypted data.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Blob lblb_data Blob lblb_key Blob lblb_iv Blob lblb_encrypt 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 lblb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, lblb_data, lblb_key, & OperationModeCBC!, lblb_iv, PKCSPadding!) |
See also