You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Request MLE**: Only supported with `JWT (JSON Web Token)` authentication type
12
12
-**Response MLE**: Only supported with `JWT (JSON Web Token)` authentication type
13
13
14
+
### MLE with JWT Key Types
15
+
16
+
MLE works with both JWT key types:
17
+
18
+
| JWT Key Type | MLE Support | Request MLE Certificate Source |
19
+
|---|---|---|
20
+
|`P12` (default) | Supported | Auto-extracted from the P12 file (using `requestMleKeyAlias`), or from a separate file via `mleForRequestPublicCertPath`|
21
+
|`SHARED_SECRET`| Supported |**Must** be provided via `mleForRequestPublicCertPath` (since there is no P12 file to extract from) |
22
+
23
+
> **Important:** When using `jwtKeyType=SHARED_SECRET` with MLE, the `mleForRequestPublicCertPath` property is **required** for request MLE. The SDK cannot auto-extract the MLE certificate from a P12 file because shared secret authentication does not use one. The request MLE public certificate can be downloaded from the CyberSource Business Center ([Test](https://businesscentertest.cybersource.com/ebc2) | [Production](https://businesscenter.cybersource.com/ebc2)).
$merchantConfig->setRequestMleKeyAlias('CyberSource_SJC_US'); // Optional, defaults to CyberSource_SJC_US
333
+
```
334
+
335
+
> **Note:** When using `jwtKeyType=SHARED_SECRET`, the MLE certificate cannot be auto-extracted from a P12 file. You **must** provide the certificate via `mleForRequestPublicCertPath`. The request MLE public certificate can be downloaded from the CyberSource Business Center ([Test](https://businesscentertest.cybersource.com/ebc2) | [Production](https://businesscenter.cybersource.com/ebc2)).
336
+
337
+
### (x) Response MLE with MetaKey
338
+
339
+
When using MetaKey (`useMetaKey=true`) with Response MLE, the response MLE private key and KID must belong to the **portfolio (parent account)**, not the transacting merchant.
> **Important:** In MetaKey mode, the portfolio is the transaction submitter. The response is encrypted using the portfolio's MLE certificate, so the decryption key must also be the portfolio's.
365
+
303
366
<br/>
304
367
305
368
## 5. JSON Configuration Examples
@@ -414,7 +477,8 @@ For Response MLE private key files, the following formats are supported:
414
477
- If `enableRequestMLEForOptionalApisGlobally` is set to `true`, it enables request MLE for all APIs that have optional MLE support
415
478
- APIs with mandatory MLE requirements are enabled by default unless `disableRequestMLEForMandatoryApisGlobally` is set to `true`
416
479
- If `mapToControlMLEonAPI` doesn't contain a specific API, the global setting applies
417
-
- For HTTP Signature authentication, request MLE will fall back to non-encrypted requests with a warning
480
+
- When using `jwtKeyType=SHARED_SECRET`, the `mleForRequestPublicCertPath` parameter is **required** because the SDK cannot auto-extract the MLE certificate from a P12 file. See [Example (ix)](#ix-request-mle-with-shared-secret-jwt-symmetric-key-authentication) for a complete configuration.
481
+
- For HTTP Signature authentication, request MLE will fall back to non-encrypted requests with a warning. **Note:** HTTP Signature is being deprecated — migrate to JWT with Shared Secret (`jwtKeyType=SHARED_SECRET`) to enable full MLE support using the same credentials. See [Example (ix)](#ix-request-mle-with-shared-secret-jwt-symmetric-key-authentication) for details.
418
482
419
483
### (ii) Response MLE
420
484
- Response MLE requires either `responseMlePrivateKey` object OR `responseMlePrivateKeyFilePath` (not both)
@@ -423,6 +487,7 @@ For Response MLE private key files, the following formats are supported:
423
487
-**Required** when using PEM format files (`.pem`, `.key`, `.p8`)
424
488
-**Required** when using `responseMlePrivateKey` object directly
425
489
- When both auto-fetched and user-provided values exist, the user-provided value takes precedence
490
+
-**MetaKey (`useMetaKey=true`):** When Response MLE is used with MetaKey, the `responseMlePrivateKeyFilePath` (or `responseMlePrivateKey` object) and `responseMleKID` must belong to the **portfolio (parent account)** — not the transacting merchant. This is because in MetaKey mode the portfolio is the transaction submitter, and the response is encrypted using the portfolio's MLE certificate.
426
491
- If an API expects a mandatory MLE response but the map specifies non-MLE response, the API might return an error
427
492
- Both the private key object and file path approaches are mutually exclusive
@@ -464,6 +529,10 @@ The SDK provides specific error messages for common MLE issues:
464
529
For comprehensive examples and sample implementations, please refer to:
465
530
[CyberSource PHP Sample Code Repository (on GitHub)](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Samples/MLEFeature)
466
531
532
+
For MLE with JWT Shared Secret (HS256) authentication specifically, see:
533
+
-[JWT Shared Secret Auth Samples](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Samples/JwtSharedSecretAuth) — includes a payment sample with MLE enabled
534
+
-[JwtSharedSecretConfiguration.php](https://github.com/CyberSource/cybersource-rest-samples-php/tree/master/Resources/JwtSharedSecretConfiguration.php) — configuration with MLE enabled
Copy file name to clipboardExpand all lines: README.md
+214-1Lines changed: 214 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ override the new secure-http default setting)*.
29
29
{
30
30
"require": {
31
31
"php": ">=8.0.0",
32
-
"cybersource/rest-client-php": "0.0.72"
32
+
"cybersource/rest-client-php": "0.0.73"
33
33
}
34
34
}
35
35
```
@@ -63,6 +63,10 @@ The API Reference Guide provides examples of what information is needed for a pa
63
63
64
64
To learn more about how to use CyberSource's REST API SDKs, please use [Developer Center REST API SDKs](https://developer.cybersource.com/hello-world/rest-api-sdks.html).
65
65
66
+
## Security Guidance
67
+
68
+
* It is strongly recommended to use HTTPS for any proxy servers in your environment to protect secrets during transit.
69
+
66
70
### Example using Sample Code Application
67
71
68
72
* Add the [CyberSource REST client](https://github.com/CyberSource/cybersource-rest-samples-php/blob/ea6dc700c833fc41f493147cdc8f1c4b5616683b/composer.json#L23) as a dependency in your php project.
@@ -107,6 +111,123 @@ This feature provides an implementation of Message Level Encryption (MLE) for AP
107
111
108
112
More information about this new MLE feature can be found in this file : [MLE.md](MLE.md)
109
113
114
+
### JWT Authentication with Symmetric Key (Shared Secret / HS256 HMAC-SHA256) Support
> **⚠️ HTTP Signature Deprecation Notice:** HTTP Signature authentication (`HTTP_SIGNATURE`) is being deprecated. JWT with Shared Secret (HS256 / HMAC-SHA256) is the **recommended migration path** — it uses the **same**`merchantKeyId` and `merchantsecretKey` credentials, requires only two property changes, and enables MLE (Message Level Encryption) support that HTTP Signature does not provide.
119
+
120
+
JWT authentication now supports two key types, configurable via the `jwtKeyType` property:
> **Note:** When `jwtKeyType` is set to `SHARED_SECRET`, the P12-related properties (`keysDirectory`, `keyFileName`, `keyAlias`, `keyPass`) are not required and will be ignored. Conversely, when using `P12`, the `merchantKeyId` and `merchantsecretKey` properties are not required for JWT authentication.
156
+
157
+
#### JSON Configuration for JWT with P12
158
+
159
+
```json
160
+
{
161
+
"authenticationType": "jwt",
162
+
"merchantID": "your_merchant_id",
163
+
"runEnvironment": "apitest.cybersource.com",
164
+
"keyAlias": "your_merchant_id",
165
+
"keyPass": "your_merchant_id",
166
+
"keyFileName": "your_merchant_id",
167
+
"keysDirectory": "path/to/p12/directory"
168
+
}
169
+
```
170
+
171
+
#### JSON Configuration for JWT with Shared Secret
#### Migrating from HTTP Signature to JWT with Shared Secret (HS256 / HMAC-SHA256)
185
+
186
+
If you are currently using HTTP Signature authentication, migrating to JWT with Shared Secret (symmetric key, HS256 / HMAC-SHA256) requires only **two property changes** — your credentials remain the same:
187
+
188
+
```php
189
+
// BEFORE (HTTP Signature — deprecated)
190
+
$config->setAuthenticationType('HTTP_SIGNATURE');
191
+
$config->setApiKeyID('your_key_id');
192
+
$config->setSecretKey('your_shared_secret');
193
+
194
+
// AFTER (JWT with Shared Secret / HS256 HMAC-SHA256 — recommended)
$config->setSecretKey('your_shared_secret'); // same
199
+
```
200
+
201
+
#### Using MLE with Shared Secret Credentials
202
+
203
+
MLE (Message Level Encryption) is fully supported with the `SHARED_SECRET` key type. This allows merchants who use shared secret credentials (instead of a P12 certificate) to still leverage MLE for secure communication.
204
+
205
+
When using `jwtKeyType=SHARED_SECRET` with MLE, you must provide the MLE public certificate separately via the `mleForRequestPublicCertPath` property, since there is no P12 file to auto-extract the MLE certificate from. The request MLE public certificate can be downloaded from the CyberSource Business Center:
> **Note:** MetaKey with JWT Shared Secret uses the same MetaKey credentials as HTTP Signature but authenticates via JWT, enabling MLE support.
278
+
279
+
#### Response MLE with MetaKey
280
+
281
+
When Response MLE is enabled (`enableResponseMleGlobally=true`) and MetaKey is in use (`useMetaKey=true`), the Response MLE configuration must use the **portfolio's** response MLE key — not the transacting merchant's. Specifically:
282
+
283
+
-`responseMlePrivateKeyFilePath` (or the `responseMlePrivateKey` object) must point to the **portfolio's** response MLE private key.
284
+
-`responseMleKID` — the KID value associated with the **portfolio's** response MLE certificate.
285
+
-**Optional** when `responseMlePrivateKeyFilePath` points to a CyberSource-generated P12 file — the SDK will automatically fetch the KID from the P12 file.
286
+
-**Required** when using PEM format files (`.pem`, `.key`, `.p8`) or when providing `responseMlePrivateKey` object directly.
287
+
288
+
```php
289
+
$config = new CyberSource\Authentication\Core\MerchantConfiguration();
> **Important:** The response MLE private key (and KID, if applicable) must belong to the portfolio (parent account), since in MetaKey mode the portfolio is the transaction submitter and the response is encrypted using the portfolio's MLE certificate. See [MLE.md](MLE.md) for full details on when `responseMleKID` is required vs optional.
309
+
118
310
Further information on MetaKey can be found in [New Business Center User Guide](https://developer.cybersource.com/library/documentation/dev_guides/Business_Center/New_Business_Center_User_Guide.pdf).
119
311
312
+
### OAuth Support
313
+
314
+
OAuth enables service providers to securely share access to customer data without sharing password data.
315
+
316
+
The CyberSource OAuth2.0 Authorization Server (or API Auth Service) will issue access tokens (based on merchant user credentials) to CyberSource or third-party Applications. These applications can access CyberSource APIs on the merchant's behalf, using the access tokens.
317
+
318
+
During application registration, third-party application developers are issued a `client_id` and optionally a `client_secret` (if they can be considered a confidential client, for example a web application).
319
+
320
+
These values will be used when the merchant application wants to request an access token and/or a refresh token. This is explained in more detail in [Requesting the Access and Refresh Tokens](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/obtaining_access_refresh_tokens.html).
321
+
322
+
For more detailed information on OAuth, refer to the documentation at [Cybersource OAuth 2.0](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html).
323
+
324
+
In order to use OAuth, set the run environment to OAuth enabled URLs. OAuth only works in these run environments.
0 commit comments