In this “How-to” guide, we will show you how to test MLE (Message Level Encryption) enabled APIs using Java.
The first step is to enable MLE for the API(s) you are interested in.
Login to your Visa Developer Dashboard and go to your project, you should see something like this:
Enable the APIs for which MLE needs to be active in VDP by toggling the API for which MLE needs to be enforced.
In this tutorial, we are going to enable MLE for Funds Transfer API And Query API:
On the left side navigation menu of your project, click on “Credentials”.
Next step we will create a Key-ID by clicking on the Generate Key-ID button.
Copy the Key-ID for your reference.
The Key-ID looks this: 41d9f2a1-xxxx-4xxx-b40c-a0480c2xxxxx
The next step is to add a CSR. Click on the link "Add CSR" .
You are prompt to submit a Certificate Signing Request.
We have the option to Generate a CSR for me (default) or submit your own. In this example, we will use the Generate a CSR for me (default) and click Confirm button.
After submitting the request, you will be prompt to download the Certificate/Copy Private Key.
After you have downloaded the private key, check the box "I confirm that I've downloaded my certificate key" and click continue. You will see the Status change to "Active".
Expand the Key-ID and you will see the Server Encryption Certificate and Client Encryption Certificate. Download both certificates.
To be able to make an API call with MLE, you need to have the following
You will need to create a maven project and import it to your IDE.
mvn archetype:generate -DgroupId=com.visa -DartifactId=mle-example -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
Please refer to the below link for creating a java project in maven:
Open the Java Class PushFundsAndQueryAPIWithMLE on your IDE and set the below parameters with your own credentials
KEYSTORE_PATH = "<YOUR KEYSTORE PATH>";
KEYSTORE_PASSWORD = "<YOUR KEYSTORE PASSWORD>";
USER_ID = "<YOUR USER ID>";
PASSWORD = "<YOUR PASSWORD>";
MLE_CLIENT_PRIVATE_KEY_PATH = "<YOUR MLE CLIENT PRIVATE KEY PATH>";
MLE_SERVER_PUBLIC_CERTIFICATE_PATH = "<YOUR MLE SERVER PUBLIC CERTIFICATE PATH>";
KEY_ID = "<YOUR KEY ID>";
Please refer to the article HelloWorld.java - How to run Java Sample Code using the Hello World API and Mutual SSL of how to create a Java KeyStore.
Want more? Join the Visa Developer Community to get alerts on the latest tutorials, guides, and new developer resources. Stay tuned for more in the series.