This parameter contains encrypted card data packaged in JWE format.
Encryption is performed using a hybrid approach:card data (PAN, expiration date, CVV2, message creation timestamp) is encrypted using AES-256-GCM;
the generated symmetric key (CEK) is encrypted using RSA-OAEP-256 (SHA-256) with the partner’s public key.
The result is encoded in Base64URL and transmitted as a single encrypted container.Encryption requirements#
| Category | Parameter | Requirement | Description |
|---|
| General | Encryption Method | Use Hybrid Encryption (Symmetric + Asymmetric) | Combines symmetric encryption for payload protection with asymmetric encryption for secure key exchange. |
| Payload Encryption | Algorithm | Use AES-256-GCM | Provides confidentiality and integrity via authenticated encryption. |
| Payload Encryption | Content Encryption Key (CEK) | Must be 256 bits and generated using CSPRNG | Symmetric key used for payload encryption. |
| Payload Encryption | Initialization Vector (IV) | Must be 96 bits (12 bytes), generated using CSPRNG and must be unique per encryption | Nonce required for AES-GCM to ensure security and prevent reuse attacks. |
| Payload Encryption | Authentication Tag | Must be 128 bits and generated during AES-GCM encryption | Ensures integrity and authenticity of encrypted data. |
| Key Encryption | Algorithm | Use RSA-OAEP-256 | Asymmetric encryption of CEK using OAEP padding with SHA-256. |
| Key Encryption | Public Key | Use recipient’s RSA public key | Used to encrypt the CEK. |
| Key Encryption | RSA Key Length | Must be ≥ 2048 bits | Ensures sufficient cryptographic strength. |
| Encoding | Encoding Scheme | Use Base64URL (without padding) | URL-safe encoding for binary data (header, encrypted key, IV, ciphertext, authentication tag). |
Encryption process (for sending data)#
Step 1. Prepare payload#
{
"pan": "1234567890123456",
"expDate": "202802",
"cvv2": "123",
"timestamp": "20260318123045"
}
Step 2. Generate CEK#
Generate a random 256-bit key using CSPRNG.Step 3. Generate IV#
Generate 12-byte IV using CSPRNG.
Must be unique per encryption.
{
"alg": "RSA-OAEP-256",
"enc": "A256GCM",
"kid": "<key identifier>"
}
Step 5. Encrypt payload (AES-256-GCM)#
Inputs: CEK, IV, Payload.
Outputs: ciphertext and authentication tag.
Step 6. Encrypt CEK (RSA-OAEP-256)#
Encrypt CEK using recipient’s public key.Step 7. Encode components#
Base64URL encode: header, encrypted_key, IV, ciphertext, authentication tag.Step 8. Build encrypted container#
After all components are generated, the encrypted container must be constructed according to JSON Web Encryption (JWE) RFC 7516 using Compact Serialization:BASE64URL(Protected Header) .
BASE64URL(Encrypted Key) .
BASE64URL(IV) .
BASE64URL(Ciphertext) .
BASE64URL(Authentication Tag)
The serialization order is strictly defined by the JWE specification and must be preserved.
eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIiwia2lkIjoiNzYxYSJ9
.
OKOawDo13gRp2ojaHV7LFp...
.
48V1_ALb6US04U3b
.
5eym8TW_c8SuK0ltJ3rpYIzO...
.
XFBoMYUZodetZdvTiFvSkQ
Decryption process (for receiving data)#
Step 1. Split encrypted container#
The input parameter pg_encrypted_card must be a JWE Compact Serialization string compliant with JSON Web Encryption (JWE) RFC 7516.
Split into exactly 5 parts using the . (dot) separator:<protected_header> .
<encrypted_key> .
<iv> .
<ciphertext> .
<authentication_tag>
Output components: after splitting, the following components are obtained:| Component | Description |
|---|
| Protected Header | Base64URL-encoded JSON containing metadata about encryption algorithms and key identifier. |
| Encrypted Key | Base64URL-encoded CEK encrypted using RSA-OAEP-256. |
| Initialization Vector (IV) | Base64URL-encoded 96-bit nonce used in AES-GCM. |
| Ciphertext | Base64URL-encoded encrypted payload. |
| Authentication Tag | Base64URL-encoded integrity/authentication tag generated by AES-GCM. |
Step 2. Base64URL decode#
Each component must be decoded from Base64URL encoding to its original binary form:protected_header → JSON (UTF-8);
encrypted_key → binary (RSA-encrypted CEK);
authentication_tag → binary (16 bytes).
Step 3. Parse and validate protected header#
The protected header must be parsed as JSON:{
"alg": "RSA-OAEP-256",
"enc": "A256GCM",
"kid": "<key identifier>"
}
| Field | Description |
|---|
alg | Key encryption algorithm (RSA-OAEP-256). |
enc | Content encryption algorithm (A256GCM). |
kid | Key identifier used to select the correct decryption key. |
If validation fails, processing will be terminated.
Step 4. Decrypt CEK (Content Encryption Key)#
The encrypted_key must be decrypted using:Key: recipient’s private RSA key (selected via kid).
Output: original CEK (256-bit AES key).Step 5. Decrypt payload (AES-256-GCM)#
The payload will be decrypted using:Inputs: CEK, IV, ciphertext, authentication_tag.
Output: decrypted payload (JSON).If verification fails, the message will be rejected and will not be processed further.
Step 6. Parse decrypted payload#
The decrypted payload will be parsed as JSON:{
"pan": "1234567890123456",
"expDate": "202802",
"cvv2": "123",
"timestamp": "YYYYMMDDHHMMSS"
}