Skip to content

Service Configurations for Client Encryption C#

Jean-Alexis Aufauvre edited this page May 30, 2021 · 9 revisions

Table of Contents

Overview

Predefined service configurations for the C# client encryption library.

Configurations

MDES Token Connect

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$.pushFundingAccount.encryptedPayload.encryptedData", "$.pushFundingAccount.encryptedPayload")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithOaepPaddingDigestAlgorithm("SHA-512")
        .WithEncryptedValueFieldName("encryptedData")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepHashingAlgorithm")
        .WithEncryptionCertificateFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Hex)
        .Build();

MDES Digital Enablement API

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$.cardInfo.encryptedData", "$.cardInfo") // Before version 1.2.9
        .WithEncryptionPath("$.fundingAccountInfo.encryptedPayload.encryptedData", "$.fundingAccountInfo.encryptedPayload")
        .WithEncryptionPath("$.encryptedPayload.encryptedData", "$.encryptedPayload")
        .WithDecryptionPath("$.tokenDetail", "$.tokenDetail.encryptedData")
        .WithDecryptionPath("$.encryptedPayload", "$.encryptedPayload.encryptedData")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithDecryptionKey(decryptionKey)
        .WithOaepPaddingDigestAlgorithm("SHA-512")
        .WithEncryptedValueFieldName("encryptedData")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepHashingAlgorithm")
        .WithEncryptionCertificateFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Hex)
        .Build();

Installment APIs

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$.calculatorReqData.primaryAccountNumber", "$.calculatorReqData")
        .WithEncryptionPath("$.configReqData.primaryAccountNumber", "$.configReqData")
        .WithEncryptionPath("$.processInstallmentReqData.primaryAccountNumber", "$.processInstallmentReqData")
        .WithEncryptionPath("$.receiveIssuerApprReqData.primaryAccountNumber", "$.receiveIssuerApprReqData")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithOaepPaddingDigestAlgorithm("SHA-256")
        .WithEncryptedValueFieldName("primaryAccountNumber")
        .WithEncryptedKeyFieldName("wrappedKey")
        .WithIvFieldName("iv")
        .WithValueEncoding(FieldValueEncoding.Base64)
        .Build();

Payment Account Management

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$.encryptedPayload.encryptedData", "$.encryptedPayload")
        .WithDecryptionPath("$.encryptedPayload", "$.encryptedPayload.encryptedData")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithDecryptionKey(decryptionKey)
        .WithOaepPaddingDigestAlgorithm("SHA-512")
        .WithEncryptedValueFieldName("encryptedData")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepHashingAlgorithm")
        .WithEncryptionCertificateFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Hex)
        .Build();

Payment Account Reference Inquiry

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$.encryptedPayload.encryptedData", "$.encryptedPayload")
        .WithDecryptionPath("$.encryptedPayload", "$.encryptedPayload.encryptedData")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithDecryptionKey(decryptionKey)
        .WithOaepPaddingDigestAlgorithm("SHA-512")
        .WithEncryptedValueFieldName("encryptedData")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepHashingAlgorithm")
        .WithEncryptionCertificateFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Hex)
        .Build();

Mastercard QR for Merchant Aggregators

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithDecryptionPath("$", "$.items")
        .WithDecryptionKey(decryptionKey)
        .WithOaepPaddingDigestAlgorithm("SHA-512")
        .WithEncryptedValueFieldName("items")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepHashingAlgorithm")
        .WithValueEncoding(FieldValueEncoding.Base64)
        .Build();

Mastercard Directory Services

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionPath("$", "$.encrypted_payload")
        .WithDecryptionPath("$.encrypted_payload", "$")
        .WithEncryptionCertificate(encryptionCertificate)
        .WithDecryptionKey(decryptionKey)
        .WithOaepPaddingDigestAlgorithm("SHA-256")
        .WithEncryptedValueFieldName("data")
        .WithEncryptedKeyHeaderName("x-encrypted-key")
        .WithIvHeaderName("x-iv")
        .WithOaepPaddingDigestAlgorithmHeaderName("x-oaep-hashing-algorithm")
        .WithEncryptionKeyFingerprintHeaderName("x-public-key-fingerprint")
        .WithValueEncoding(FieldValueEncoding.Base64)
        .Build();

Buyer Payment Agent

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithEncryptionCertificate(encryptionCertificate) 
        .WithDecryptionKey(decryptionKey) 
        .WithEncryptionPath("$.card", "$.encryptedCard") 
        .WithDecryptionPath("$.encryptedCard", "$.card") 
        .WithOaepPaddingDigestAlgorithm("SHA-256") 
        .WithEncryptedValueFieldName("encryptedValue") 
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv") 
        .WithOaepPaddingDigestAlgorithmFieldName("oaepPaddingDigestAlgorithm")
        .WithEncryptionKeyFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Base64) 
        .Build();

Supplier Payment Agent

var config = FieldLevelEncryptionConfigBuilder.AFieldLevelEncryptionConfig()
        .WithDecryptionKey(decryptionKey)
        .WithDecryptionPath("$.encryptedCard", "$.card")
        .WithOaepPaddingDigestAlgorithm("SHA-256")
        .WithEncryptedValueFieldName("encryptedValue")
        .WithEncryptedKeyFieldName("encryptedKey")
        .WithIvFieldName("iv")
        .WithOaepPaddingDigestAlgorithmFieldName("oaepPaddingDigestAlgorithm")
        .WithEncryptionKeyFingerprintFieldName("publicKeyFingerprint")
        .WithValueEncoding(FieldValueEncoding.Base64)
        .Build();