# Authentication and Encryption source: https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-basics/authentication-and-encryption/index.md Consumer Clarity for Merchants uses a merchant-hosted integration model. Ethoca initiates requests to the endpoints implemented by the merchant. The merchant receives each request, validates the applicable authentication information, and processes the request only after validation succeeds. ## Supported Authentication Methods {#supported-authentication-methods} The Merchant Transaction API supports the following authentication methods: * HMAC authentication * OAuth 2.0 authentication The authentication method is selected during onboarding. Each request uses one authentication method. ### HMAC authentication {#hmac-authentication} For HMAC authentication, Ethoca signs each request using the API secret key associated with the key ID exchanged securely between Ethoca and the merchant. The merchant validates the signature on the incoming request using the corresponding API secret key. The `Authorization` header uses one of the following formats: ```text Authorization: ETHOCA-SHA1 KeyRef=,Signature= ``` ```text Authorization: ETHOCA-SHA512 KeyRef=,Signature= ``` Authentication keys must have at least 128 bits of entropy and must be exchanged securely out of band. For implementation guidance, see [How to Create an HMAC Signature](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/how-to-create-hmac-signature/index.md). ### OAuth 2.0 authentication {#oauth-20-authentication} Merchants that select OAuth 2.0 must implement the `POST /oauth2/token` endpoint. Ethoca calls this merchant-hosted endpoint to obtain a short-lived access token using the OAuth 2.0 client credentials grant. The token endpoint supports the following client authentication methods: * `client_secret_post` * `private_key_jwt` After obtaining a token, Ethoca includes it in requests to protected merchant endpoints: ```text Authorization: Bearer ``` The merchant validates the Bearer token before processing the request. Merchants using HMAC authentication don't need to implement the OAuth 2.0 token endpoint. ### Validate incoming requests {#validate-incoming-requests} For each request received from Ethoca: 1. Confirm that the request was received over HTTPS. 2. Identify the authentication method from the `Authorization` header. 3. Validate the HMAC signature or OAuth 2.0 Bearer token, as applicable. 4. For HMAC requests, validate the key ID and signature using the corresponding API secret key. 5. Validate the request timestamp in the `X-Eth-Date` header when included. 6. Reject requests that fail authentication or timestamp validation. 7. Process the request only after all required validation succeeds. ## Encryption {#encryption} The merchant-hosted endpoint must use HTTPS to protect data in transit. HTTP without SSL/TLS is not supported. When payload encryption is required for the integration, decrypt the payload using the encryption key provisioned for the integration before processing its contents. Encryption keys are different from authentication keys. ## Information Security {#information-security} Requests from Ethoca and responses from the Merchant Transaction API may contain personally identifiable information (PII). Ethoca classifies this data as "Regulated-Classified." Do not send production data to the Sandbox environment. ## Replay Mitigation {#replay-mitigation} For HMAC-authenticated requests, validate the incoming request timestamp to reduce the risk of replay attacks. Reject requests outside the acceptable time window established for the integration. ## See Also {#see-also} For request headers, response elements, and implementation requirements, see [API Request/Response Common Elements and Headers](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/api-basics/common-elements-headers/index.md). ## Next Steps {#next-steps} Continue to [Getting Started](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/getting-started/index.md) for the end-to-end integration process.