Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phax/phase4/llms.txt
Use this file to discover all available pages before exploring further.
WS-Security in AS4
AS4 uses the OASIS WS-Security standard to protect SOAP messages. phase4 delegates all cryptographic operations to the Apache WSS4J library, which implements WS-Security 1.0 and 1.1. Two security operations are applied to AS4 messages:| Operation | Purpose | Direction |
|---|---|---|
| Signing | Proves the message was sent by the claimed party and has not been altered | Outbound — sign with your private key; inbound — verify with sender’s certificate |
| Encryption | Ensures only the intended recipient can read the payload | Outbound — encrypt with receiver’s public key; inbound — decrypt with your private key |
Signing and encryption are separate operations. A message can be signed only, encrypted only, both, or neither — depending on the profile and PMode security settings.
The IAS4CryptoFactory interface
IAS4CryptoFactory is the central crypto abstraction in phase4. It provides:
- A WSS4J
Cryptoobject for signing and verification operations - Access to the signing key store and private key entry
- Access to the trust store for validating inbound signatures
AS4CryptoFactoryInMemoryKeyStore
Accepts
KeyStore objects you load programmatically. Nothing is read from disk at construction time. Use this when you manage key stores in your application.AS4CryptoFactoryConfiguration
Reads key store path, alias, and password from the global phase4 configuration file (
phase4.properties / application.properties). Suitable for file-based deployments.Configuring AS4CryptoFactoryInMemoryKeyStore
UseAS4CryptoFactoryInMemoryKeyStore when you load key stores from your application’s classpath, a database, or a secrets manager.
IKeyStoreAndKeyDescriptor and ITrustStoreDescriptor descriptors from the com.helger.security.keystore package if you use the helger security infrastructure:
Configuring signing parameters
AS4SigningParams holds all settings that control how outbound messages are signed and how inbound signatures are verified.
ECryptoAlgorithmSign — signature algorithms
| Enum constant | Algorithm URI |
|---|---|
RSA_SHA_256 (default) | http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 |
RSA_SHA_384 | http://www.w3.org/2001/04/xmldsig-more#rsa-sha384 |
RSA_SHA_512 | http://www.w3.org/2001/04/xmldsig-more#rsa-sha512 |
ECDSA_SHA_256 | http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256 |
ECDSA_SHA_384 | http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384 |
ECDSA_SHA_512 | http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512 |
EDDSA_ED25519 | EdDSA Ed25519 |
EDDSA_ED448 | EdDSA Ed448 |
RSA_SHA_256_MGF1 | RSA-PSS SHA-256 |
RSA_SHA_512_MGF1 | RSA-PSS SHA-512 |
ECryptoAlgorithmSignDigest — digest algorithms
| Enum constant | Algorithm URI |
|---|---|
DIGEST_SHA_256 (default) | http://www.w3.org/2001/04/xmlenc#sha256 |
DIGEST_SHA_384 | SHA-384 |
DIGEST_SHA_512 | SHA-512 |
Configuring AS4SigningParams
Configuring encryption parameters
AS4CryptParams holds all settings that control outbound payload encryption.
ECryptoAlgorithmCrypt — symmetric encryption algorithms
| Enum constant | Key size | Mode |
|---|---|---|
AES_128_GCM (default) | 128-bit | GCM |
AES_256_GCM | 256-bit | GCM |
AES_128_CBC | 128-bit | CBC |
AES_192_CBC | 192-bit | CBC |
AES_256_CBC | 256-bit | CBC |
AES_192_GCM | 192-bit | GCM |
CRYPT_3DES | 168-bit | CBC (legacy) |
Configuring AS4CryptParams
Key agreement (eDelivery AS4 2.0)
For profiles that use key agreement instead of key transport (e.g. eDelivery AS4 2.0 with X25519 or ECDH-ES), use the convenience methods:Trust store configuration
The trust store contains the CA certificates used to validate inbound signatures. If you passnull as the trust store to AS4CryptoFactoryInMemoryKeyStore, phase4 falls back to the JRE’s default cacerts trust store.
Applying crypto settings from a PMode
If you have aPModeLegSecurity object (from a PMode leg), you can populate AS4SigningParams and AS4CryptParams directly from it: