This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KeyStore keyStore = KeyStore.getInstance("PKCS12"); | |
FileInputStream clientCertificateContent = new FileInputStream("/path/to/publicAndPrivateKey.p12"); | |
keyStore.load(clientCertificateContent, "private key password".toCharArray()); | |
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); | |
keyManagerFactory.init(keyStore, "private key password".toCharArray()); | |
FileInputStream myTrustedCAFileContent = new FileInputStream("/path/to/embedded/CA-Chain.pem"); | |
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); | |
X509Certificate myCAPublicKey = (X509Certificate) certificateFactory.generateCertificate(myTrustedCAFileContent); |