Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

AEM Certficate to create a token

Avatar

Level 5

HI Team,

 

We are using below code and its working as expected in local environment but when we deploy the same into dev and QA. its not working throwing a below error.

certificate saved under etc as p12 format.

Code:

SSLContext sslContext = SSLContexts.createSystemDefault();
Resource resource = resolver.getResource(certificatePath);
Node jcnode = resource.adaptTo(Node.class).getNode(Constant.JCR_CONTENT);
InputStream stream = jcnode.getProperty(Constant.JCR_DATA).getBinary().getStream();
KeyStore keystore = KeyStore.getInstance(Constant.JKS);
keystore.load(stream, KEYSTORESECRET.toCharArray());
sslContext = SSLContexts.custom().loadKeyMaterial(keystore, KEYSTORESECRET.toCharArray()).build();

return sslContext

 

Error: 

createSSLContext() Invalid keystore format
 Name or service not known

 

 

1 Reply

Avatar

Community Advisor

Can you validate if your local Java version is what you have in DEV and QA?