XMLEncrypt Component
Properties Methods Events Configuration Settings Errors
The XMLEncrypt component is used to encrypt and decrypt XML.
Syntax
TipcXMLEncrypt
Remarks
The XMLEncrypt component 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 the EncryptedDataDetail* properties. The Decrypt method will decrypt the XML document.
The component supports encrypting and decrypting with a shared SymmetricKey, and also using asymmetric encryption to encrypt the SymmetricKey (session key) via the RecipientCert* and Cer* properties.
Encrypt
To begin first specify a XML document by setting InputFile, or InputXML.
The EncryptedDataDetail* properties 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* properties are 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* properties are 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:
- SymmetricKey (required)
- EncryptingAlgorithm
- EncryptedDataDetail*
- RecipientCert*
- KeyName
Input and Output Properties
The component 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:- 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 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 Cert* properties 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:
- SymmetricKey
- Certificate
Input and Output Properties
The component 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:- 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 component with short descriptions. Click on the links for further details.
CertEncoded | The certificate (PEM/base64 encoded). |
CertStore | The name of the certificate store for the client certificate. |
CertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
CertStoreType | The type of certificate store for this certificate. |
CertSubject | The subject of the certificate used for client authentication. |
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. |
RecipientCertEncoded | The certificate (PEM/base64 encoded). |
RecipientCertStore | The name of the certificate store for the client certificate. |
RecipientCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
RecipientCertStoreType | The type of certificate store for this certificate. |
RecipientCertSubject | The subject of the certificate used for client authentication. |
SymmetricKey | The symmetric key used to encrypt and decrypt the XML. |
UseOAEP | Whether to use Optimal Asymmetric Encryption Padding (OAEP). |
Method List
The following is the full list of the methods of the component 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 component 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 component with short descriptions. Click on the links for further details.
DecryptWithCryptoAPI | Whether to use the Crypto API for decrypt operations. |
EncryptedKeyXPath | The XPath of the EncryptedKey element. |
KeyName | The name of the key used to encrypt the XML. |
LogLevel | Specifies the level of detail that is logged. |
OAEPMGF1HashAlgorithm | The MGF1 hash algorithm used with OAEP. |
OAEPParams | The hex encoded OAEP parameters. |
OAEPRSAHashAlgorithm | The RSA hash algorithm used with OAEP. |
OAEPRSAHashAlgorithm | The RSA hash algorithm used when encrypting a key. |
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. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
UseInternalSecurityAPI | Tells the component whether or not to use the system security libraries or an internal implementation. |