Visa-Api Reference 讲解 two way ssl(转)

https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl#ssl_handshake

SSL Handshake

In Two-Way SSL authentication, the client and server need to authenticate and validate each others identities. The authentication message exchange between client and server is called an SSL handshake, and it includes the following steps:

  1. A client requests access to a protected resource.
  2. The server presents its certificate to the client.
  3. The client verifies the server's certificate.
  4. If successful, the client sends its certificate to the server.
  5. The server verifies the client’s credentials.
  6. If successful, the server grants access to the protected resource requested by the client.

In step 5 (above), the server validates the client, which is the second part of the Two-Way SSL (Mutual Authentication) process. This is typically done by making sure that the client certificate is valid (non-expired and issued by a trusted Certificate Authority), as well as the client’s digital signature is valid. The digital signature is produced using the private key from the client. Anyone that has the public key can validate the digital signature. (However, only the client that has the private key can create a valid signature.)

Establishing SSL Connection

To establish a Two-Way SSL (Mutual Authentication) connection, you must have the following:

  • private key
  • client certificate
  • certificate authority root certificate, and 
  • certificate authority intermediate certificates (Note: These certificates are optional for the Visa Developer sandbox)

The following steps include examples for context.

  1. Place your private key file (for example: privateKey.pem and your certificate file from VDP (for example: cert.pem in the same directory. Generate a keystore (for example: myProject_keyAndCertBundle.p12) file as shown below.

    > openssl pkcs12 -export -in cert.pem -inkey "privateKey.pem" -certfile cert.pem -out myProject_keyAndCertBundle.p12

    Note: The myProject_keyAndCertBundle.p12 is only a placeholder file name. You may choose to name it anything else.
     
  2. If you need a Java Key Store, run the following Java keytool command to convert your P12 file into a JKS file.

    > keytool -importkeystore -srckeystore myProject_keyAndCertBundle.p12 -srcstoretype PKCS12 -destkeystore myProject_keyAndCertBundle.jks

  3. Run the following Java keytool command to validate the contents of your new JKS file.

    > keytool -list -v -keystore myProject_keyAndCertBundle.jks

  4. Run the following command to add the root certificate to your JKS file.

    > keytool -import -alias ejbca -keystore myProject_keyAndCertBundle.jks -file VDPCA-SBX.pem -storepass <password>

Configuring Two-Way SSL Keystore with Java Keytool

Keytool is a certificate management utility that is part of the standard Java distribution.

If you use a JKS file as your truststore, follow the instructions below to add the DigiCert Global Root CA certificate to your truststore.

  1. Download the DigiCert Global Root CA certificate from https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt to your local folder.
  2. Backup your truststore JKS file as a safeguard.
  3. Then, run the following keytool command to add it your truststore

keytool -import -alias DigiCertGlobalCA -keystore <Path to JKS (TrustStore) file> -file DigiCertGlobalRootCA.crt

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值