xml.Encryption methods

Methods for the xml.Encryption class.

Table 1. Class methods: Creation
Name Description
xml.Encryption.Create()
  RETURNING enc xml.Encryption 
Constructor of an Encryption object.
Table 2. Class methods: String encryption and decryption
Name Description
xml.Encryption.DecryptString(
   key xml.CryptoKey ,
   str STRING )
  RETURNING rstr STRING
Decrypts the encrypted string str encoded in BASE64, using the symmetric key key, and returns the string in clear text.
xml.Encryption.EncryptString(
   key xml.CryptoKey,
   str STRING )
  RETURNING rstr STRING
Encrypts the string str using the symmetric key key, and returns the encrypted string encoded in BASE64.
xml.Encryption.RSADecrypt(
   key STRING,
   enc STRING )
  RETURNING rstr STRING
Decrypts the BASE64 encrypted string enc using the RSA key key and returns it in clear text
xml.Encryption.RSAEncrypt(
   key STRING,
   str STRING )
  RETURNING rstr STRING
Encrypts the string str using the RSA key key and returns it encoded in BASE64.

The methods listed in Table 2 do not belong to the XML encryption specification, but are helper functions to allow BDL application to encrypt and decrypt short passwords with RSA keys, or big strings by using symmetric keys. Notice that a common way to encrypt data is to use symmetric keys, and to use RSA keys to encrypt the symmetric key value.

Table 3. Object methods: Key and certificate setting
Name Description
getEmbeddedKey()
  RETURNING key xml.CryptoKey
Get a copy of the embedded symmetric key that was used in the last decryption operation.
setCertificate(
   cert xml.CryptoX509 )
Assigns a copy of the X509 certificate to this Encryption object.
setKey(
   key xml.CryptoKey )
Assigns a copy of the symmetric key to this Encryption object.
setKeyEncryptionKey(
   key xml.CryptoKey )
Assigns a copy of the key-encryption key to this Encryption object.
Table 4. Object methods: XML elements encryption and decryption
Name Description
decryptElement(
   enc xml.DomNode )
Decrypts the EncryptedData DomNode enc using the symmetric key.
decryptElementContent(
   enc xml.DomNode )
Decrypts the EncryptedData DomNode enc using the symmetric key.
encryptElement(
   node xml.DomNode )
Encrypts the ELEMENT DomNode node and all its children using the symmetric key.
encryptElementContent(
   node xml.DomNode )
Encrypts all child nodes of the ELEMENT DomNode node using the symmetric key.
Table 5. Object methods: Detached XML elements encryption and decryption
Name Description
decryptElementDetached(
   enc xml.DomNode )
  RETURNING node xml.DomNode
Decrypts the EncryptedData DomNode enc using the symmetric key, and returns it in a new ELEMENT node
decryptElementContentDetached(
   enc xml.DomNode )
  RETURNING node xml.DomNode
Decrypts the EncryptedData DomNode enc using the symmetric key, and returns all its children in one new DOCUMENT_FRAGMENT_NODE node.
encryptElementDetached(
   node xml.DomNode )
  RETURNING rnode xml.DomNode
Encrypts the ELEMENT DomNode node and all its children using the symmetric key, and returns them as one new EncryptedData node.
encryptElementContentDetached(
   node xml.DomNode )
  RETURNING rnode xml.DomNode
Encrypts all child nodes of the ELEMENT DomNode node using the symmetric key, and returns them as one new EncryptedData node.
Table 6. Object methods: Key encryption and decryption
Name Description
decryptKey(
   xml xml.DomDocument,
   url STRING )
  RETURNING key xml.CryptoKey
Decrypts the EncryptedKey as root in the given XML document, and returns a new CryptoKey of the given kind.
encryptKey(
   key xml.CryptoKey )
  RETURNING doc xml.DomDocument
Encrypts the given symmetric or HMAC key as an EncryptedKey node and returns it as root node of a new XML document .