AEM Certficate to create a token | Community
Skip to main content
AEMLearner-1989
Level 4
July 21, 2022
Question

AEM Certficate to create a token

  • July 21, 2022
  • 1 reply
  • 533 views

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

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

rawvarun
Community Advisor
Community Advisor
June 15, 2023

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