X4 Help Center
7.5 7.4 German English
Auto Light Dark
Auto Light Dark
7.5 7.4 German English

XML Encryption (Password)

This adapter encrypts or decrypts any XML document according to the W3C standard XML-Encryption (XML-Enc) based on a password. This adapter supports the AES encryption algorithm with 128, 192 or 256 Bit key length as well as the Triple-DES algorithm. For encryption/decryption based on a keystore, see XML Encryption (Keystore).

Properties

Operation

Defines the operation executed by the function adapter

Possible values:

  • Encrypt: Encrypt input XML document

  • Decrypt: Decrypt input XML document

Parameters

method

Algorithm used for encryption/decryption

Possible values:

  • AES_128: Use AES algorithm with 128 Bit key length

  • AES_192: Use AES algorithm with 192 Bit key length

  • AES_256: Use AES algorithm with 256 Bit key length

  • TRIPLEDES: Use Triple-DES algorithm

xpath

Path to the element(s) to be encrypted/decrypted addressed using an XPath expression

Possible values:
Any valid XPath expression, e.g. //Data

scope

Defines the encryption scope within the XML document structure that matches the XPath expression

Possible values:

  • Element: Encrypts the whole element

  • Content: Encrypts only the element contents

password

Password used for encryption/decryption

Possible values:
Any string

Status values

-1 (error)

An error occurred during the adapter's execution (see  X4 Server  log).

In case of an error, this adapters also outputs a text file that contains the corresponding exception.

0 (empty)

Document has not been changed. No matching elements were found.

1 (successful)

Document has been processed, and all matching elements have been encrypted/decrypted.

Example

In the following XML document, all Data elements are to be encrypted using XML-Encryption with the AES128 algorithm:

Input
XML
<RootElement>
  <Data>Hello</Data>
  <Data>World!</Data>
  <Public>© SoftProject GmbH</Public>
</RootElement>

As an example, the adapter returns the following encrypted result XML document:

Result
XML
<RootElement>
   <Data>
      <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
         Type="http://www.w3.org/2001/04/xmlenc#Content">
         <xenc:EncryptionMethod 
            Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" />
         <xenc:CipherData>
            <xenc:CipherValue>JS1lBp4RcMk6RepmptplJnBGqbpINGHSV9THG7+UJcY
            </xenc:CipherValue>
         </xenc:CipherData>
      </xenc:EncryptedData>
   </Data>
   <Data>
      <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
         Type="http://www.w3.org/2001/04/xmlenc#Content">
         <xenc:EncryptionMethod 
          Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" />
         <xenc:CipherData>
            <xenc:CipherValue>rO+m1iPwsw4/PaP2AokM30DqsqeD1OYRvD7KNG+bnxc
            </xenc:CipherValue>
         </xenc:CipherData>
      </xenc:EncryptedData>
   </Data>
   <Public>© SoftProject GmbH</Public>
</RootElement>