Package com.adyen.util
Class CertificateUtil
- java.lang.Object
-
- com.adyen.util.CertificateUtil
-
public final class CertificateUtil extends Object
Utility class for loading X.509 certificates and Java KeyStores.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CertificateloadCertificate(InputStream inputStream)Loads an X.509 certificate from an input stream.static CertificateloadCertificate(String filePath)Loads an X.509 certificate from the given file path.static KeyStoreloadKeyStore(String keyStorePath, String keyStoreType, String keyStorePassword)Loads a KeyStore from the specified file path using the given type and password.
-
-
-
Method Detail
-
loadCertificate
public static Certificate loadCertificate(String filePath) throws FileNotFoundException, CertificateException
Loads an X.509 certificate from the given file path.- Parameters:
filePath- Filepath of the certificate- Returns:
- instance of the certificate
- Throws:
FileNotFoundException- if file is not foundCertificateException- if any error occurred while reading the certificate
-
loadCertificate
public static Certificate loadCertificate(InputStream inputStream) throws CertificateException
Loads an X.509 certificate from an input stream.- Parameters:
inputStream- InputStream containing the certificate.- Returns:
- instance of the certificate
- Throws:
CertificateException- if any error occurred while reading certificate from stream
-
loadKeyStore
public static KeyStore loadKeyStore(String keyStorePath, String keyStoreType, String keyStorePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException
Loads a KeyStore from the specified file path using the given type and password.- Parameters:
keyStorePath- file pathkeyStoreType- keystore type (JKS/PKCS12 etc)keyStorePassword- keystore password- Returns:
- the loaded KeyStore instance.
- Throws:
KeyStoreException- if the keystore type is invalid.CertificateException- if a certificate in the keystore could not be loaded.NoSuchAlgorithmException- if the algorithm for checking the keystore integrity cannot be found.IOException- if there is an I/O or format problem with the keystore data.
-
-