How do I encrypt PayPal HTML in ASP.NET?
Note: The PayPal .NET SDKs also include support for Encrypted Website Payments, as of release 4_2_1.
Install OpenSSL for Windows
- Download OpenSSL for Windows and install it.
- Choose the option to add OpenSSL to your system PATH during installation.
Create your own private key and public certificate using OpenSSL
- Create your private key file:
- Run the following OpenSSL command from the command prompt:
openssl genrsa -out test-prvkey.pem 1024
- Run the following OpenSSL command from the command prompt:
- This will create your private key file; in this example, the filename is test-prvkey.pem.
- Create your public certificate file:
- Run the following OpenSSL command:
openssl req -new -key test-prvkey.pem -x509 -days 365 -out test-pubcert.pem
- You must be in the same directory as your private key file.
- This will generate your public certificate file; in this example, the filename is test-pubcert.pem.
- Run the following OpenSSL command:
- Once you have your private key and public certificate, upload your public certificate file and register it on your PayPal account.
Upload your public certificate
- Log in to your Business or Premier PayPal account.
- Select Profile > Profile & settings.
- Click My selling tools.
- Click Encrypted payment settings.
- Click Add. The Add Certificate webpage appears.
- Click Choose File, and select the public certificate you want to upload.
- When your public certificate is successfully uploaded, it appears on the next screen under Your Public Certificate.
- After you successfully upload your certificate, PayPal assigns a corresponding Certificate ID (cert_id).
- Keep the Certificate ID in a safe place, as you'll need it later to make an encrypted button.
Download PayPal's public certificates
- Log in to your Business or Premier PayPal account.
- Select Profile > Profile & settings.
- Click My selling tools.
- Click Encrypted payment settings.
- Click Download under PayPal Public Certificate.
Allow encrypted website payments only (optional) To prevent a third party from creating a "spoof" version of your Encrypted Website Payment buttons, you can block unencrypted website payments, if you wish. Here's how:
- Log in to your Business or Premier PayPal account.
- Select Profile > Profile & settings.
- Click My selling tools.
- Click Update next to Website preferences.The Website Payment Preferences screen appears.
- Select On for Block Non-encrypted Website Payment.
- Click Save.
Was this article helpful?