XMLEncrypt Bean
Properties Methods Events Configuration Settings Errors
The XMLEncrypt component is used to encrypt and decrypt XML.
Syntax
IPWorksEncrypt.Xmlencrypt
Remarks
The XMLEncrypt bean provides a simple API for encrypting and decrypting XML. The Encrypt method will encrypt the XML document, or a specific element. Multiple elements may be encrypted at one time by setting EncryptedDataDetails. The Decrypt method will decrypt the XML document.
The bean supports encrypting and decrypting with a shared SymmetricKey, and also using asymmetric encryption to encrypt the SymmetricKey (session key) via the RecipientCert and Certificate properties.
Encrypt
To begin first specify a XML document by calling SetInputStream or setting InputFile, or InputXML.
The EncryptedDataDetails property specify the XML element to encrypt. By default the entire XML document is encrypted.
The SymmetricKey property specifies the key which will be used to encrypt the data.
If the RecipientCert property is set, then the SymmetricKey will be encrypted and included in the encrypted data. This allows for the recipient to decrypt the key, with their certificate. Encrypting the symmetric key is also referred to as using a session key. The benefit of using certificate to encrypt and decrypt a session key (SymmetricKey) is that knowledge of the key value is not needed ahead of time to process the encrypted data. Note that if specified, RecipientCert MUST have a RSA key, not a DSA key.
If the RecipientCert property is not set, then the recipient must know the value of SymmetricKey before decrypting the XML. The KeyName setting may be set to provide a key identifier to the recipient.
Optionally set EncryptingAlgorithm, and then call Encrypt to encrypt the XML.
The following properties are applicable when calling this method:
Input and Output Properties
The bean will determine the source and destination of the input and output based on which properties are set.
The order in which the input properties are checked is as follows:
When a valid source is found the search stops. The order in which the output properties are checked is as follows:- SetOutputStream
- OutputFile
- OutputXML: The output data is written to this property if no other destination is specified.
Decrypt
To begin first specify a XML document by calling SetInputStream or setting InputFile, or InputXML.
The SymmetricKey property specifies the key used to decrypt the data. This may be set before calling Decrypt or inside the EncryptedDataInfo event. The EncryptedDataInfo event fires once for each encrypted element when Decrypt is called.
If the data was encrypted using an session key, set the Certificate property to the certificate with private key before calling Decrypt. The certificate will be used to decrypt the encrypted session key. In this case the SymmetricKey property is ignored.
The following properties are applicable when calling this method:
Input and Output Properties
The bean will determine the source and destination of the input and output based on which properties are set.
The order in which the input properties are checked is as follows:
When a valid source is found the search stops. The order in which the output properties are checked is as follows:- SetOutputStream
- OutputFile
- OutputXML: The output data is written to this property if no other destination is specified.
Property List
The following is the full list of the properties of the bean with short descriptions. Click on the links for further details.
Certificate | The certificate used for decryption. |
EncryptedDataDetails | A collection of encrypted data details. |
EncryptingAlgorithm | Then encryption algorithm used when encrypting. |
InputFile | The XML file to process. |
InputXML | The XML to process. |
OutputFile | The output file. |
OutputXML | The output XML after processing. |
Overwrite | Indicates whether or not the component should overwrite files. |
RecipientCert | The certificate used for encryption. |
SymmetricKey | The symmetric key used to encrypt and decrypt the XML. |
Method List
The following is the full list of the methods of the bean with short descriptions. Click on the links for further details.
config | Sets or retrieves a configuration setting . |
decrypt | Decrypts the XML. |
doEvents | Processes events from the internal message queue. |
encrypt | Encrypts the XML. |
reset | Resets the component. |
setInputStream | Sets the stream from which the component will read data to encrypt or decrypt. |
setOutputStream | The stream to which the component will write the encrypted or decrypted XML. |
Event List
The following is the full list of the events fired by the bean with short descriptions. Click on the links for further details.
EncryptedDataInfo | Fired once for each encrypted element when Decrypt is called. |
Error | Information about errors during data delivery. |
Progress | Fired as progress is made. |
Status | Provides information about the current operation. |
Configuration Settings
The following is a list of configuration settings for the bean with short descriptions. Click on the links for further details.
KeyName | The name of the key used to encrypt the XML. |
LogLevel | Specifies the level of detail that is logged. |
EncryptedKeyXPath | The XPath of the EncryptedKey element. |
OAEPParams | The hex encoded OAEP parameters. |
MGF1HashAlgorithm | The MGF1 hash algorithm used with OAEP. |
RSAHashAlgorithm | The RSA hash algorithm used when encrypting a key. |
UseOAEP | Whether to use Optimal Asymmetric Encryption Padding (OAEP). |
ReadFromProgressEvent | Whether to read input data from inside the progress event. |
WriteToProgressEvent | Whether to write output data so it is accessible from inside the progress event. |
DecryptWithCryptoAPI | Whether to use the Crypto API for decrypt operations. |
CodePage | The system code page used for Unicode to Multibyte translations. |