xml.Encryption.EncryptString

Encrypts the specified string using the symmetric key, and returns the encrypted string encoded in BASE64.

Syntax

xml.Encryption.EncryptString(
   key xml.CryptoKey,
   str STRING )
  RETURNS STRING
  1. key defines the key.
  2. str defines the string to be encrypted.

Usage

This method encrypts the string specified in str using the symmetric key defined by key, and returns the encrypted string encoded in BASE64.

The key's usage must be for encryption, see Supported kind of keys.

There are some considerations to take into account when encrypting / decrypting a string in languages other than Genero BDL. The encryption and decryption of a string follows XML-Encryption specification. It defines two rules you must adapt when coding in another language:
  1. The initialization vector (IV) is concatenated to the beginning of the encrypted string.
  2. A padding value defined as ISO 10126 may be appended to the end of the encrypted string.
For more details see https://www.w3.org/TR/xmlenc-core/#sec-Alg-Block.

In case of error, the method throws an exception and sets the status variable. Depending on the error, a human-readable description of the problem is available in the sqlca.sqlerrm register. See Error handling in GWS calls (status).