Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

 

 

0 Replies