All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mastercard.developer.encryption.EncryptionConfig Maven / Gradle / Ivy

There is a newer version: 1.8.3
Show newest version
package com.mastercard.developer.encryption;

import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.util.Collections;
import java.util.Map;

public abstract class EncryptionConfig {

    protected EncryptionConfig() {
    }

    /**
     * The different methods of encryption
     */
    public enum Scheme {
        LEGACY,
        JWE
    }

    /**
     * The encryption scheme to be used
     */
    Scheme scheme = Scheme.LEGACY;

    /**
     * The SHA-256 hex-encoded digest of the key used for encryption (optional, the digest will be
     * automatically computed if this field is null or empty).
     * Example: "c3f8ef7053c4fb306f7476e7d1956f0aa992ff9dfdd5244b912a1d377ff3a84f"
     */
    String encryptionKeyFingerprint;

    /**
     * A certificate object whose public key will be used for encryption.
     */
    Certificate encryptionCertificate;

    /**
     * A private key object to be used for decryption.
     */
    PrivateKey decryptionKey;

    /**
     * A list of JSON paths to encrypt in request payloads.
     * Example:
     * 
     * new HashMap<>() {
     *     {
     *         put("$.path.to.element.to.be.encrypted", "$.path.to.object.where.to.store.encryption.fields");
     *     }
     * }
     * 
*/ Map encryptionPaths = Collections.emptyMap(); /** * A list of JSON paths to decrypt in response payloads. * Example: *
     * new HashMap<>() {
     *     {
     *         put("$.path.to.object.with.encryption.fields", "$.path.where.to.write.decrypted.element");
     *     }
     * }
     * 
*/ Map decryptionPaths = Collections.emptyMap(); /** * The name of the payload field where to write/read the encrypted data value. */ String encryptedValueFieldName = null; public String getEncryptionKeyFingerprint() { return encryptionKeyFingerprint; } public Certificate getEncryptionCertificate() { return encryptionCertificate; } public PrivateKey getDecryptionKey() { return decryptionKey; } public Scheme getScheme() { return scheme; } Map getEncryptionPaths() { return encryptionPaths; } Map getDecryptionPaths() { return decryptionPaths; } String getEncryptedValueFieldName() { return encryptedValueFieldName; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy