Help Article

Ask the Community

Find answers or join the conversation in the Community Help Forum.

How do I encrypt PayPal HTML in ASP.NET?

PayPal provides a .NET sample application/DLL that you can use in an ASP.NET application to ease integration. This FAQ explains how to get this DLL and use it in your web application.

Note: The PayPal .NET SDKs also include support for Encrypted Website Payments, as of release 4_2_1. This FAQ doesn't discuss the SDKs, so see the SDK documents for more information.

 


Install OpenSSL for Windows

  1. Download OpenSSL for Windows and install it.
  2. Choose the option to add OpenSSL to your system PATH during installation.
 

Create your own private key and public certificate using OpenSSL

  1. Create your private key file:
    • Run the following OpenSSL command from the command prompt:
      openssl genrsa -out test-prvkey.pem 1024
  • This will create your private key file; in this example, the filename is test-prvkey.pem.
  1. 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.
  1. 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

  1. Log in to your Business or Premier PayPal account.
  2. Select Profile > Profile & settings.
  3. Click My selling tools.
  4. Click Encrypted payment settings.
  5. Click Add. The Add Certificate webpage appears.
  6. Click Choose File, and select the public certificate you want to upload.
  7. When your public certificate is successfully uploaded, it appears on the next screen under Your Public Certificate.
  8. After you successfully upload your certificate, PayPal assigns a corresponding Certificate ID (cert_id).
  9. Keep the Certificate ID in a safe place, as you'll need it later to make an encrypted button.

 


Download PayPal's public certificates

  1. Log in to your Business or Premier PayPal account.
  2. Select Profile > Profile & settings.
  3. Click My selling tools.
  4. Click Encrypted payment settings.
  5. 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:
  1. Log in to your Business or Premier PayPal account.
  2. Select Profile > Profile & settings.
  3. Click My selling tools.
  4. Click Update next to Website preferences.The Website Payment Preferences screen appears.
  5. Select On for Block Non-encrypted Website Payment.
  6. Click Save.
Note: If you're building your application in Visual Studio, you must add ButtonEncryptionLib.dll to your ASP.NET project as a reference, or copy it into the project's bin folder.
We’re sorry, the page you’re looking for is no longer available. Please try your search again in our Help Centre if you have a question or want to contact us.