On This Page
Create or Submit a P12 Certificate
This section describes how to create or submit a P12 certificate and how to extract its private
key. A private key is necessary for you to construct JSON Web Tokens.
Create
a
P12 certificate if you need a new certificate. Submit
a P12 certificate if you
want to use your own certificate.Creating a P12 Certificate
Follow these steps to create a P12 certificate file if you are using JSON Web Tokens
to secure communication:
- Log in to theGateway Portal:
- On the left navigation panel, choosePayment Configuration > Key Management.
- Click+ Generate keyon the Key Management page.
- Under REST APIs, chooseREST – Certificate, and then clickGenerate key.If you are using aportfolioaccount, the Key options window appears, giving you the choice to create a meta key.For more information about how to create a meta key, see .
- ClickDownload key
.
- Create a password for the certificate by entering one into theNew PasswordandConfirm Passwordfields. ClickGenerate key.
The.p12file downloads to your desktop.If prompted by your system, approve the location to which the key downloads.
To create or upload another key, click
Generate another key
. To view all of
your created keys, go to the Key Management page.IMPORTANT
Securely store the
.p12
file and password in your system. These
credentials are required in order to implement certain products, and you must be
able to access them.Submitting a P12 Certificate
Follow these steps to submit your own public PEM-formatted certificate signing
request (CSR) if you are using JSON Web Tokens to secure communication. You also have
the option to create a P12 certificate from your CSR to use for testing purposes.
- Log in to theGateway Portal:
- On the left navigation panel, choosePayment Configuration > Key Management.
- Click+ Generate keyon the Key Management page.
- Under REST APIs, chooseREST – Certificate, and then clickGenerate key.If you are using aportfolioaccount, the Key options window appears, giving you the choice to create a meta key.For more information about how to create a meta key, see .
- Enter your public PEM-formatted certificate in the text box, then clickDownload key
.
If you need to generate your own CSR and private key, run this command. In this example,merchantis your organization or merchant ID (MID). You can extract the certificate value by opening theexample.csrfile using a text editor application.openssl req -new -newkey rsa:2048 -keyout private_key.pem -out example.csr -sha256 -nodes -subj "/CN=merchant"
- (Optional) To convert your submitted CSR into a.p12file, run this command. In this example,merchantis your organization or merchant ID (MID).You can use the P12 certificate for testing using theREST API Referenceon the Developer Center.openssl pkcs12 -export -name "$(printf 'serialnumber=%s,cn=%s' "$(openssl x509 -inmerchant_certChain.pem -noout -serial | cut -d= -f2 | xxd -r -p)" "$(openssl x509 -inmerchant_certChain.pem -noout -subject | sed -n 's/.*CN=\([^/]*\).*/\1/p')" )" -outmerchant.p12 -inkey private_key.pem -inmerchant_certChain.pem
- When prompted, set a password for the.p12file.
To create or upload another key, click
Generate another key
. To view all of
your created keys, go to the Key Management page.IMPORTANT
Securely store your key's password in your system. These credentials
are required to implement certain products and you must be able to access them.
Extracting the Private Key from Your P12 Certificate
When you have your P12 certificate, extract the private key from the certificate. Use this key
to sign your header when sending an API request.
IMPORTANT
If you are using the SDK to establish communication, you do not
need to extract the private key from the P12 certificate.
- Prerequisite
- You must have a tool such as OpenSSL installed on your system.
- Extract the Private Key
- Follow these steps to extract the private key using OpenSSL:
- Open the command-line tool and navigate to the directory that contains the P12 certificate.
- Enter this command:openssl pkcs12 -in [certificate name] -nodes -nocerts -out [private key name]
- Enter the password for the certificate.You set this password when you created the P12 certificate in theGateway Portal.
The new certificate is added to the directory with the private key name you supplied in Step 2.
Testing Your Private Key
After creating your key certificate, you must verify that it can successfully process
API requests. This task explains how to test and validate your private key in the
Developer Center and the
Gateway Portal
.Follow these steps:
- Go to the Developer Center's API Reference page:
- On the left navigation panel, click .
- Under Authentication and Sandbox Credentials, go to the Authentication Type drop-down menu and chooseJSON Web Token.
- Enter your organization ID in theOrganizationfield.
- Enter your Password in thePasswordfield.
- ClickBrowseand upload your p12 certificate from your desktop.
- ClickUpdate Credentials.A confirmation message states that your credentials are successfully updated.
- Go to the Developer Center's API Reference and navigate toPayments >.POSTProcess a Payment
- ClickSend.
A message confirms that your request was successful with the status code 201.
- Log in to theGateway Portal:
- On the left navigation panel, chooseTransaction Management > Transactions.
- Under Search Results, verify that the request ID from the test authorization response is listed in the Request ID column.If the test authorization was successful, a success message is present in the corresponding Applications column.