Creating SSLContext from private key and cer files

I have two files: mycer.cer mykey.key

I need to create an SslContext to connect to another server via SSL using java. I am trying to figure out how I can create an SslContext object directly from these files.

This entry may be duplicated, but I tried to find a clear explanation with an example for creating an SslContext, but did not find anything clear.

Thank you in advance

+6
source share
1 answer

To get a certificate in p12 format, as far as I know, you cannot use a cert file, there are utilities for this (for example, openssl) source (from where you generated the downloaded certificate) can give you p12 format.

openssl pkcs12 -export -in mycer.crt -inkey mykey.key -out mycer.p12 -name "mycer"

URL. .

HTTPS Java

, !

0

Source: https://habr.com/ru/post/1017182/


All Articles