Codeunit EncryptedXml
Provides functionality for encrypting and decrypting XML documents.
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Encrypt
Creates a symmetric session key to encrypt the outer XML of an element using the specified X.509 certificate.
procedure Encrypt(var XmlDocument: XmlDocument, ElementToEncrypt: Text, X509CertBase64Value: Text, X509CertPassword: SecretText)
Parameters
| Name | Type | Description |
|---|---|---|
| XmlDocument | XmlDocument |
The XmlDocument to encrypt. |
| ElementToEncrypt | Text |
The name of the element to encrypt. |
| X509CertBase64Value | Text |
The X509Certificate2 to use for the asymmetric encryption. |
| X509CertPassword | SecretText |
Password to the X509Certificate2. |
Encrypt
Creates a symmetric session key using the specified SymmetricAlgorithm to encrypt the outer XML of an element using the specified X.509 certificate.
procedure Encrypt(var XmlDocument: XmlDocument, ElementToEncrypt: Text, X509CertBase64Value: Text, X509CertPassword: SecretText, SymmetricAlgorithm: Enum SymmetricAlgorithm)
Parameters
| Name | Type | Description |
|---|---|---|
| XmlDocument | XmlDocument |
The XmlDocument to encrypt. |
| ElementToEncrypt | Text |
The name of the element to encrypt. |
| X509CertBase64Value | Text |
The X509Certificate2 to use for the asymmetric encryption. |
| X509CertPassword | SecretText |
Password to the X509Certificate2. |
| SymmetricAlgorithm | Enum System.Security.Encryption.SymmetricAlgorithm |
The symmetric algorithm to be used when encrypting. |
DecryptDocument
Decrypts all EncryptedData elements of the XML document using the specified asymmetric key.
procedure DecryptDocument(var EncryptedDocument: XmlDocument, EncryptionKey: SecretText, SignatureAlgorithm: Enum SignatureAlgorithm): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EncryptedDocument | XmlDocument |
The XML document to decrypt. |
| EncryptionKey | SecretText |
The asymmetric key to use to decrypt the symmetric keys in the document. |
| SignatureAlgorithm | Enum System.Security.Encryption.SignatureAlgorithm |
The asymmetric algorithm used to decrypt the symmetric key. |
Returns
| Type | Description |
|---|---|
| Boolean |
Returns true if decryption was successful, otherwise false. |
DecryptKey
Decrypts an EncryptedKey XML element using an asymmetric algorithm.
procedure DecryptKey(EncryptedKey: XmlElement, EncryptionKey: SecretText, UseOAEP: Boolean, var KeyBase64Value: Text, SignatureAlgorithm: Enum SignatureAlgorithm): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EncryptedKey | XmlElement |
The EncryptedKey XML element with the key to be decrypted. |
| EncryptionKey | SecretText |
The asymmetric key used to decrypt the symmetric key. |
| UseOAEP | Boolean |
A value that specifies whether to use Optimal Asymmetric Encryption Padding (OAEP). |
| KeyBase64Value | Text |
The Base64 encoded decrypted key value. |
| SignatureAlgorithm | Enum System.Security.Encryption.SignatureAlgorithm |
The asymmetric algorithm used to decrypt the symmetric key. |
Returns
| Type | Description |
|---|---|
| Boolean |
Returns true if decryption was successful, otherwise false. |