Decrypt

Description:              The Decrypt function decrypts data previously encrypted using the Encrypt function. It is the VTS analog of the CryptoAPI CryptDecrypt call.

Returns:                    Text

Usage:                       Script

Format:                      Decrypt(Key, CipherText, Final [, Reserved, Flags, Error])

Parameters:             Key     { handle }  { required }  { no default }
          The handle to the key to use to decrypt the data.

                                    CipherText     { text }  { required }  { no default }
          A text string that contains the cipher text to be decrypted.

                                    Final      { Boolean }  { required }  { no default }
          A parameter that specifies whether this is the last section in a series being decrypted. Final is set TRUE for the last or only block and FALSE if there are more blocks to be decrypted

                                    Reserved     n/a
          An optional parameter which should be set to 0. If omitted or invalid, then the value 0 is used.

                                    Flags     { numeric }  { optional }  { default: 0 }
          An optional parameter specifying the flags to be passed to CryptDecrypt. If omitted or invalid then the value 0 is used.

                                    Error     { numeric }  { required }  { no default }
          An optional variable in which the error code for the function is returned. It has the following meaning:

Value

Meaning

0

Key successfully imported.

1

Key, CipherText or Final parameters invalid.

x

Any other value is an error from CryptDecrypt.

 

Comments:               The plain text is returned as a text string. If an error occurs, the return value is invalid.

Example:

[

  PlainText2; 

]

Init [

  If 1 Main; 

  [ 

    PlainText2 = Decrypt(Key4, CipherText1, 1, 0, 0); 

  ] 

]

See Also:

DeriveKey | Encrypt | ExportKey | GenerateKey | GetCryptoProvider | GetKeyParam | ImportKey | SetKeyParam