Debugging the SSL Issues in Linux
First of all the JVM Needs to start in the Debug mode as many servers report the errors vaguely. It is better to start in Debug mode
Add the JVM parameter
-Djavax.net.debug=all
After that before Even trying to run the transaction try to connect the server with the
certificate using openssl
openssl s_client -showcerts -connect 10.24.256.69:443
If the certificate is present it shows the last statement as
Verify return code: 0 (ok)
Check the link below for a more detailed tutorial.
http://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/
If for some reason is receiving an error
So what u do is
nmap -sS 10.24.256.69
sample output for above command
Host is up (0.0051s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
443/tcp open https
and we can identify the port as 443.
Try the first command again with right port.
Once you have the certificate listed, you can check the expiration date with this command
Check this link for more details
http://www.shellhacks.com/en/HowTo-Check-SSL-Certificate-Expiration-Date-from-the-Linux-Shell
or do this to extract all the information
So if you get any other error which means you have to import the certificate, here is the easy way to do it
Check this link for more Details
https://myonlineusb.wordpress.com/2011/06/19/how-to-convert-certificates-between-pem-der-p7bpkcs7-pfxpkcs12/
You have the pem file in the same location
Convert it to der to import to JKS
openssl x509 -outform der -in certificate.pem -out certificate.der
Edit the below command with your specific values to import .der to JKS keystore
keytool -import -alias your-alias -keystore cacerts -file certificate.der
Add the JVM parameter
-Djavax.net.debug=all
After that before Even trying to run the transaction try to connect the server with the
certificate using openssl
openssl s_client -showcerts -connect 10.24.256.69:443
If the certificate is present it shows the last statement as
Verify return code: 0 (ok)
Check the link below for a more detailed tutorial.
http://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/
If for some reason is receiving an error
OpenSSL: socket: Connection refused connect:errno=111
It means that the PORT might be wrong in the connection. So we need to find the right port on which https is running. This can be done using nmapSo what u do is
nmap -sS 10.24.256.69
sample output for above command
Host is up (0.0051s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
443/tcp open https
and we can identify the port as 443.
Try the first command again with right port.
Once you have the certificate listed, you can check the expiration date with this command
$ echo | openssl s_client -connect 10.24.256.69:443 2>/dev/null | openssl x509 -noout -dates notBefore=Jun 19 12:44:04 2013 GMT notAfter=Oct 31 23:59:59 2013 GMT
Check this link for more details
http://www.shellhacks.com/en/HowTo-Check-SSL-Certificate-Expiration-Date-from-the-Linux-Shell
or do this to extract all the information
$ echo | openssl s_client -connect 10.24.256.69:443 2>/dev/null | openssl x509 -noout -text
So if you get any other error which means you have to import the certificate, here is the easy way to do it
Information On Certificates and Formats
NOTE: Only way to tell the difference between PEM .cer and DER .cer is to open the file in a Text editor and look for the BEGIN/END statements.
PEM Format
It is the most common format that Certificate Authorities issue certificates in. It contains the ‘—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–” statements.
It is the most common format that Certificate Authorities issue certificates in. It contains the ‘—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–” statements.
Several PEM certificates and even the Private key can be included in one file, one below the other. But most platforms(eg:- Apache) expects the certificates and Private key to be in separate files.
> They are Base64 encoded ACII files
> They have extensions such as .pem, .crt, .cer, .key
> Apache and similar servers uses PEM format certificates
> They are Base64 encoded ACII files
> They have extensions such as .pem, .crt, .cer, .key
> Apache and similar servers uses PEM format certificates
DER Format
It is a Binary form of ASCII PEM format certificate. All types of Certificates & Private Keys can be encoded in DER format
> They are Binary format files
> They have extensions .cer & .der
> DER is typically used in Java platform
It is a Binary form of ASCII PEM format certificate. All types of Certificates & Private Keys can be encoded in DER format
> They are Binary format files
> They have extensions .cer & .der
> DER is typically used in Java platform
P7B/PKCS#7
They contain “—–BEGIN PKCS—–” & “—–END PKCS7—–” statements. It can contain only Certificates & Chain certificates but not the Private key.
> They are Base64 encoded ASCII files
> They have extensions .p7b, .p7c
> Several platforms supports it. eg:- Windows OS, Java Tomcat
They contain “—–BEGIN PKCS—–” & “—–END PKCS7—–” statements. It can contain only Certificates & Chain certificates but not the Private key.
> They are Base64 encoded ASCII files
> They have extensions .p7b, .p7c
> Several platforms supports it. eg:- Windows OS, Java Tomcat
PFX/PKCS#12
They are used for storing the Server certificate, any Intermediate certificates & Private key in one encryptable file.
> They are Binary format files
> They have extensions .pfx, .p12
> Typically used on Windows OS to import and export certificates and Private keys
They are used for storing the Server certificate, any Intermediate certificates & Private key in one encryptable file.
> They are Binary format files
> They have extensions .pfx, .p12
> Typically used on Windows OS to import and export certificates and Private keys
Check this link for more Details
https://myonlineusb.wordpress.com/2011/06/19/how-to-convert-certificates-between-pem-der-p7bpkcs7-pfxpkcs12/
Importing a Certificate
openssl s_client -showcerts -connect 10.24.256.69:443 | openssl x509 -outform PEM > mycertfile.pemYou have the pem file in the same location
Convert it to der to import to JKS
openssl x509 -outform der -in certificate.pem -out certificate.der
Edit the below command with your specific values to import .der to JKS keystore
keytool -import -alias your-alias -keystore cacerts -file certificate.der
copied from link https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them
| |
Certificates and EncodingsAt its core an X.509 certificate is a digital document that has been encoded and/or digitally signed according to RFC 5280.In fact, the term X.509 certificate usually refers to the IETF’s PKIX Certificate and CRL Profile of the X.509 v3 certificate standard, as specified in RFC 5280, commonly referred to as PKIX for Public Key Infrastructure (X.509). X509 File ExtensionsThe first thing we have to understand is what each type of file extension is. There is a lot of confusion about what DER, PEM, CRT, and CER are and many have incorrectly said that they are all interchangeable. While in certain cases some can be interchanged the best practice is to identify how your certificate is encoded and then label it correctly. Correctly labeled certificates will be much easier to manipulatEncodings (also used as extensions)
Common Extensions
|
Comments
Post a Comment