xml.Encryption.RSAEncrypt
Encrypts the specified string using the RSA key and returns it encoded in BASE64.
Syntax
xml.Encryption.RSAEncrypt(
filename STRING,
str STRING )
RETURNS STRING
- filename defines the filename of an RSA public or private key in PEM format
or an encryption key entry in the FGLPROFILE file.
If your FGLPROFILE file contains an entry for an encryption key, such as
xml.myRsa.key="/opt/fourjs/crt/myRsa.pem"
, where "myRsa" is the identifier for this entry, you can retrieve the associated value by passing "myRsa" as a parameter to the method. For an example using the method to load an encryption key, go to Loading an asymmetric RSA key. For more information on security FGLPROFILE entries, go to XML configuration and FGLPROFILE: XML cryptography. - str defines the string to be encrypted.
Usage
RSA encryption is only intended for short strings that cannot exceed the size of the RSA key
minus 12 bytes. For instance, if you have a RSA key of 512 bits, you password cannot exceed 512/8-12
= 52 bytes. If you need to handle big strings, you must use symmetric keys and the xml.Encryption.EncryptString
method. However, you can use RSA keys to encrypt symmetric key values.
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).