SymmetricKey Property
The symmetric key used to encrypt and decrypt the XML.
Syntax
xmlencrypt.getSymmetricKey([callback]) xmlencrypt.setSymmetricKey( symmetricKey_Buffer, [callback])
Default Value
""
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getSymmetricKey([callback]) method is defined as:
function(err, buffer){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'buffer' is the value returned by the method.
The callback for the setSymmetricKey([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This property specifies the symmetric key used to encrypt and decrypt the XML.
Encrypt Notes
When calling Encrypt if the RecipientCert* properties are set, then the SymmetricKey will be encrypted and included in the XML as an encrypted key. Using asymmetric encryption to encrypt the SymmetricKey allows for secure transmission of the key. This is also referred to as using a session key, as no prior knowledge of the SymmetricKey is required by the recipient.
If the RecipientCert* properties are set and SymmetricKey is left empty, then a SymmetricKey value will automatically be generated by the class when Encrypt is called.
When calling Encrypt if the RecipientCert* properties are are not set, then the SymmetricKey value must be known by the recipient before the message can be decrypted.
Decrypt Notes
When calling Decrypt if the data contains an encrypted key the class will attempt to use the certificate specified by the Cert* properties to decrypt the encrypted key and this property is ignored.
When calling Decrypt if the data does not contain an encrypted key then SymmetricKey must be set either before calling Decrypt, or within the EncryptedDataInfo event.
Legal Key and Block Sizes (in bits)
AES | DES | 3DES | |
Minimum Key Size | 128 | 64 | 128 |
Maximum Key Size | 256 | 64 | 192 |
Key Size Step | 64 | 0 | 64 |
Block Size | 128 | 64 | 64 |
This property is not available at design time.
Data Type
Buffer