Friday, December 2, 2016

Test Two-Way-SSL Using Postman

Introduction

This short post explains how to test two-way-ssl using postman. The same principle applies to SoapUI. For details about how to create two-way-ssl service will be explained in later post.

Assumption

  1. You have client.keystore.jks and client.truststore.jks.
  2. You have tested both file using restclient

JKS To PCS12

keytool -importkeystore 
     -srckeystore client.keystore.jks 
     -destkeystore client.p12 
     -srcstoretype JKS 
     -deststoretype PKCS12 
     -deststorepass clientpass 
     -srcstorepass clientpass 
     -srcalias mule-client 
     -destalias mule-client

Import client.p12 To KeyChain

Open KeyChain Access (MacOs)
File -> Import Items
Now Search for the alis "mule-client"

Test Using Postman

In my case, I use this url for two ssl: https://localhost:8543/twoway. When I send a POST request, postman will as certificates to send to the server as the following: Choose "localhost" one.

Test Using curl

Local Host Test


URL: https://localhost:8543/twoway

curl -k --cert client.p12:clientpass \
     -X POST -H "Content-Type: application/json" \
     -d '{"name": "Gary Liu"}' \
      https://localhost:8543/twoway

Test For CloudHub

CloudHub behave different for two-ssl. The port will be 8082, regardless what you set in the file of mule.dev.properties
URL: https://mule-worker-twowayssl-poc.cloudhub.io:8082/twoway
curl -k --cert client.p12:clientpass \
     -X POST -H "Content-Type: application/json" \
     -d '{"name": "Gary Liu"}' \
     https://mule-worker-twowayssl-poc.cloudhub.io:8082/twoway

5 comments:

  1. Very nice information on Mulesoft. You can also check goformule for mulesoft tutorials

    ReplyDelete
  2. Thanks Gary for the post.
    I'm getting the following error when I'm testing with curl command,
    "curl: (58) could not load PEM client certificate, OpenSSL error error:0909006C:PEM routines:get_name:no start line, (no key found, wrong pass phrase, or wrong file format?)"

    ReplyDelete
  3. Such a Wonderful Information
    SAP GRC
    Igrowsoft solutions

    ReplyDelete

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...