WS-Security Encryption
Tip
This document explains the detailed usage of a specific policy. If you are using Apinizer policies for the first time or want to learn the general working principles of policies, we recommend reading the What is Policy? page first.
Overview
What is its Purpose?
- Ensures data privacy by requiring encryption of sensitive fields in SOAP-based integrations with the certificate set expected by the target system.
- Provides a reusable security layer compliant with corporate standards with selectable encryption algorithms and key identifier types.
- Enables implementation of differentiated protection strategies by field by performing fragment-based encryption on service messages passing through API Proxy.
- Creates a flexible and controlled security mechanism that is applied only in calls where the target system has WS-Security support, with mustUnderstand flag and condition-based application support.
Working Principle
- Request Arrival: For each HTTP/HTTPS request arriving at the API Gateway, the source IP address of the request is identified.
- Policy Check: If the WS-Security Encryption policy is active, the system checks in the following order:
- Is a Condition defined? If so, is the condition met?
- Is the policy active (active=true)?
- Is a Variable used or is Apinizer default used?
- WS-Security Encryption Check: The policy encrypts XML elements or contents defined in encPartList using the certificate in the selected keystore, with specified encodeType and algorithms.
- Decision Making:
- Match Found: All parts are successfully encrypted, SOAP envelope is updated and sent to target endpoint.
- No Match: Policy is not applied, request is forwarded in original form.
- Error Handling: Customizable HTTP status code and error message are returned for requests that do not comply with the policy rule.
Features and Capabilities
Basic Features
- Certificate-Based Encryption: Encryption is performed with the public key expected by the target system by selecting X.509 certificates stored in corporate keystores.
- Flexible Encryption Algorithms: Selection can be made from common WS-Security algorithms such as AES 128/192/256-CBC and RSA/RSA-OAEP.
- Target Fragment Management: XML fragments determined by namespace and element name can be encrypted at content or element level.
- Active/Passive Status Control: Easily change the active or passive status of the policy (active/passive toggle). In passive state, the policy is not applied but its configuration is preserved.
- Condition-Based Application: Determine when the policy will be applied by creating complex conditions with Query Builder (e.g., only for specific endpoints or header values).
Advanced Features
- mustUnderstand Enforcement: Ensures that the target service must process the WS-Security block by marking the mustUnderstand flag in the SOAP header.
- Embedded Key Name Management: When Embedded Key Info is selected, key name is defined to meet special requirements of the target system.
- Multiple Fragment Configuration: Supports complex message templates by simultaneously encrypting multiple SOAP Segments.
- Export/Import Feature: Export policy configuration as a ZIP file. Import to different environments (Development, Test, Production). Version control and backup capability.
- Policy Group and Proxy Group Support: Manage multiple policies within Policy Group. Bulk policy assignment to Proxy Groups. Centralized update and deploy operations.
- Deploy and Versioning: Deploy policy changes to live environment. See which API Proxies use it (Policy Usage). Proxy Group and Policy Group usage reports.
Usage Scenarios
| Scenario | Status | Solution (Policy Application) | Expected Behavior / Result |
|---|---|---|---|
| Finance SOAP Service | Financial credit calculation service expects customer TCKN field encrypted. | Relevant certificate is selected from keystore, CustomerInfo element is added to encPartList as ELEMENT. | Customer information in SOAP envelope is encrypted, target system requirement is met. |
| Health Information Sharing | SOAP message carrying health data contains sensitive fields. | MedicalRecord element is marked as CONTENT, AES-256 is selected. | Content can only be decrypted at target system, data privacy is protected. |
| Multiple Endpoint Management | Need to use the same policy in different API Proxies. | Global policy is created, assigned to relevant API Proxies through Policy Group. | Centralized management is provided, updates propagate from single point. |
| Signed and Encrypted Message | Target system expects both signature and encryption. | WS-Security Encryption policy handles encryption part, additionally WS-Security Signature policy is applied. | Integrity and privacy are ensured through combined use. |
| Temporary Key in Test Environment | Different keystore required for test environment. | Copied to test environment with Import, encKeyStoreId is updated to point to test keystore. | Encryption continues with environment-specific certificate, live configuration is preserved. |
| mustUnderstand Requirement | Target SOAP server indicates that WS-Security header is mandatory. | mustUnderstand is marked, custom error message is defined for failure cases. | If target service does not process header, error is returned, issue is quickly detected. |
| Content-Based Condition | Encryption required only in certain operations. | Policy is applied for relevant operations by checking SOAPAction header in Condition. | Unnecessary encryption is prevented, performance is optimized. |
Configuring Policy Parameters
In this step, users can create a new policy or configure existing policy parameters to define access rules. The defined parameters directly affect how the policy works (e.g., which IPs will be allowed, geographical restrictions, conditional activations, etc.). This allows the policy to be customized according to organization-specific requirements and managed centrally.
Creating a New WS-Security Encryption Policy