I have an issue with new integration that I am working on it. I should consume a web service provided by external company and this service is over https, so in order to integrate with them, they have shared Three certificates:
- Root.cer
- Sahred.cer and the issuer is Root.cer
- user.cer and the issuer is Shared.cer
I have installed all of them and I run below commands with no lock.
openssl connect command to the web service with showcerts option
openssl s_client -showcerts -connect https://example.com:8443
output:
CONNECTED(00000003)
depth=1 C = UK, O = EXA, OU = EXA eTrust Center, CN = EXA Shared CA
verify error:num=20:unable to get local issuer certificate
140539532310416:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1493:SSL alert number 40
140539532310416:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177:
---
Certificate chain
0 s:/C=SA/O=EXA/OU=EXA eTrust Center/CN=example.com
i:/C=SA/O=EXA/OU=EXA eTrust Center/CN=EXA Shared CA
-----BEGIN CERTIFICATE-----
-----------
-----END CERTIFICATE-----
1 s:/C=SA/O=EXA/OU=EXA eTrust Center/CN=EXA Shared CA
i:/C=SA/O=EXA/OU=EXA eTrust Center/CN=EXA Root CA
-----BEGIN CERTIFICATE-----
------
-----END CERTIFICATE-----
---
Server certificate
subject=/C=SA/O=EXA/OU=EXA eTrust Center/CN=example.com
issuer=/C=SA/O=EXA/OU=EXA eTrust Center/CN=EXA Shared CA
---
No client certificate CA names sent
curl command with handshake debugging:
curl -X POST https://example.com:8443 -iv
output:
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [87 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3593 bytes data]
* TLSv1.2 (OUT), TLS alert, Server hello (2):
} [2 bytes data]
* SSL certificate problem: unable to get local issuer certificate
* stopped the pause stream!
curl command with handshake debugging and skip verification:
curl -X POST https://example.com:8443 -iv -k
output:
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [87 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3593 bytes data]
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
{ [36 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
} [7 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS alert, Server hello (2):
{ [2 bytes data]
* error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
My Questions:
- What are the benefits from creating three certificates with issuer like that ?
- why the ssl handshake has failed ? Did I miss any thing in my commands ?
- Do you any idea how can I deal with these certificates or at lease how this communication works ?
- I really don't get it how this communication works. How can I submit these certificates without any private key. Based on my understanding when we want to create ssl based authentication I should create a public key and private key and I should share this public key with the external company, so they can decrypt the message when I encrypted by my private key. is this right ?
also I have posted a question with java in stackoverflow with no lock, you can take a look for more info https://stackoverflow.com/questions/53420158/ssl-handshake-failure-client-certifcate-not-being-sent