Package com.mastercard.developer.utils
Class EncryptionUtils
java.lang.Object
com.mastercard.developer.utils.EncryptionUtils
Utility class for loading certificates and keys.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrivateKeyloadDecryptionKey(InputStream keyDataStream) Load a RSA decryption key from key data in bytes.static PrivateKeyloadDecryptionKey(String keyFilePath) Load a RSA decryption key from a file (PEM or DER).static PrivateKeyloadDecryptionKey(String pkcs12KeyFilePath, String decryptionKeyAlias, String decryptionKeyPassword) Load a RSA decryption key out of a PKCS#12 container.static CertificateloadEncryptionCertificate(InputStream certificateStream) Populate a X509 encryption certificate object with the certificate data at the given certificate data in bytes.static CertificateloadEncryptionCertificate(String certificatePath) Populate a X509 encryption certificate object with the certificate data at the given file path.static StringsanitizeJson(String json)
-
Method Details
-
loadEncryptionCertificate
public static Certificate loadEncryptionCertificate(String certificatePath) throws CertificateException, IOException Populate a X509 encryption certificate object with the certificate data at the given file path.- Throws:
CertificateExceptionIOException
-
loadEncryptionCertificate
public static Certificate loadEncryptionCertificate(InputStream certificateStream) throws CertificateException Populate a X509 encryption certificate object with the certificate data at the given certificate data in bytes.- Throws:
CertificateException
-
loadDecryptionKey
public static PrivateKey loadDecryptionKey(String keyFilePath) throws GeneralSecurityException, IOException Load a RSA decryption key from a file (PEM or DER).- Throws:
GeneralSecurityExceptionIOException
-
loadDecryptionKey
public static PrivateKey loadDecryptionKey(InputStream keyDataStream) throws GeneralSecurityException, IOException Load a RSA decryption key from key data in bytes.- Throws:
GeneralSecurityExceptionIOException
-
loadDecryptionKey
public static PrivateKey loadDecryptionKey(String pkcs12KeyFilePath, String decryptionKeyAlias, String decryptionKeyPassword) throws GeneralSecurityException, IOException Load a RSA decryption key out of a PKCS#12 container.- Throws:
GeneralSecurityExceptionIOException
-
sanitizeJson
-