Assigns a copy of the key-encryption key to this encryption object.


   key xml.CryptoKey )
  1. key defines the key-encryption key.


Any further XML encryption will use that key-encryption key to encrypt the symmetric key set with setKey() within the resulting XML, and any further XML decryption will use that key-encryption key to decrypt the embedded symmetric key.
  • NULL is allowed, meaning that embedded symmetric keys will not be encrypted nor decrypted anymore, assuming that they have been exchanged in another way.

  • Only public or private RSA keys, or key-wrap keys are allowed.

  • Public RSA keys can encrypt but not decrypt.

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).