# Decryption
source: https://developer.mastercard.com/account-catalog-services/tutorial/testing-acs-detail-response-api-in-sandbox/step4/index.md

## Decryption {#decryption}

The decryption of the payload for each call are done using classes defined by the Mastercard Client Encryption library.  

The request body of the service calls is encrypted and put in Mastercard Encryption format. The details of what kind of keys to use, how to request and manage keys, and the algorithms used to encrypt or decrypt are present on the [API Basics](https://developer.mastercard.com/account-catalog-services/documentation/api-basics/index.md) page.

```java

// change these values accordingly

String mastercardEncryptionKeyFilePath = "#PATH AND NAME OF YOUR P12 FILE HERE#";
String mastercardEncryptionAlias = "#YOUR KEY ALIAS HERE#";
String mastercardEncryptionPass = "#YOUR KEY PASSWORD HERE#";



// Step 1.1 - The response received from the call will need to be decrypted using this key
PrivateKey decryptionKey = EncryptionUtils.loadDecryptionKey(
        mastercardEncryptionKeyFilePath,
        mastercardEncryptionAlias,
        mastercardEncryptionPass);

// Step 1.2 -- Prepare JWEConfig
JweConfig config = JweConfigBuilder.aJweEncryptionConfig()
        .withDecryptionKey(decryptionKey)
        .withDecryptionPath("$.encryptedValue", "$")
        .withEncryptedValueFieldName("encryptedValue")
        .build();
		
		
// Step 1.3 -- Prepare FieldLevelEncryptionConfig
String decryptedPayload =FieldLevelEncryption.decryptPayload(encryptedPayload, decryptionConfig);
```

