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

XML Encryption (Keystore)

This adapter encrypts or decrypts any XML document according to the W3C standard XML-Encryption (XML-Enc) based on a PKCS12 or JCEKS keystore. 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 password, see XML Encryption (Password).

Properties

Operation

Defines the operation executed by the function adapter

Possible values:

  • Encrypt: Encrypt input XML document

  • Decrypt: Decrypt input XML document

Parameters

Adapter

Main adapter class (do not change!)

Possible values: de.softproject.integration.adapter.xml.encryption.XmlEncryption: Main class (Default)

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

  • Element: Encrypt the whole element

  • Content: Encrypt only the element content

keyStoreURL

URL to a valid keystore document

Possible values:
Any valid URL, e.g. x4db:/1/Project/MyKeystore.pkcs12

keyStoreType

Keystore type to be used

Possible values:

  • jceks: Use keystore in the JCEKS format

  • pkcs12: Use keystore in the PKCS12 format

password

Password to access the keystore

Possible values:
Any string

alias

Alias for the key inside the keystore

Possible values:
Any string

aliasPassword

Password to retrieve the key via its alias specified above (optional)

Possible values:

  • Any string

  • (empty): Use keystore password (default)

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:

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:

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>