Skip to main content

RSA Key Generation

About 2 min

RSA Key Generation Guide

Smilepayz API requests are signed with your merchant RSA private key. You upload the matching public key in the merchant backend so Smilepayz can verify your signatures. This guide walks through generating and saving keys in sandbox and production.

Overview

KeyWho holds itPurpose
Merchant private keyYou (never upload)Sign Pay-in, Pay-out, and Inquiry API requests
Merchant public keyUploaded to SmilepayzSmilepayz verifies your X-SIGNATURE
Platform public keyCopied from Configuration InfoYou verify callback signatures

Use separate key pairs

Generate different RSA key pairs for sandbox and production. Do not reuse sandbox private keys in production.

Key requirements

The merchant backend enforces 2048-bit RSA keys (SHA256withRSA signing). The UI stores your public key as Base64 text without PEM headers in the input field.

  • Private key — keep the downloaded file secure; used on your server only
  • Public key — paste or auto-fill in Merchant Public Key, then Save

For how signatures use the private key, see Signature Authorization.

Sandbox: generate and save keys

Step 1: Open API Setting

  1. Sign in to the merchant backendopen in new window.
  2. Switch the top toggle to Sandbox.
  3. Open Configuration in the left sidebar.
  4. Select the API Setting tab.
  5. Scroll to Merchant Public Key.

Step 2: Generate the key pair

  1. Click Generate RSA Keys.
  2. The browser downloads a key-pair file (filename includes Sandbox and a timestamp).
  3. The public key is auto-filled in the text box below the buttons.

Step 3: Save the public key

  1. Confirm the public key in the text box.
  2. Click Save at the bottom of the section.
  3. Store the downloaded file in a secure location — it contains your private key.

Sandbox — Merchant Public Key

Production: generate and save keys

Production uses Settings → Configuration instead of the sandbox Configuration menu.

Step 1: Open API Setting

  1. Sign in to the merchant backendopen in new window.
  2. Ensure the top toggle is Production.
  3. Go to SettingsConfiguration.
  4. Open the API Setting tab.
  5. Scroll to Merchant Public Key.

Step 2: Generate and save

  1. Click Generate (production label; same action as sandbox).
  2. Save the downloaded private-key file securely.
  3. Review the public key in the text box.
  4. Click Save API configuration at the bottom of the page.

Production API Setting differences

On production API Setting, IP whitelist entries are display-only (maintained by the platform). Callback fields are labeled Payin and Payout. The save button reads Save API configuration.

Production — Merchant Public Key

Downloaded key file

The downloaded file typically contains PEM blocks for both keys:

-----BEGIN PRIVATE KEY-----
[Base64 private key content]
-----END PRIVATE KEY-----

-----BEGIN PUBLIC KEY-----
[Base64 public key content]
-----END PUBLIC KEY-----

Use the private key (PKCS#8, Base64) in your integration code or SDK. The value in the backend text box matches the public key content without -----BEGIN/END----- lines.

After configuration

  1. Configure Integration Information (IP whitelist, callback URLs) if not done yet.
  2. Test signing on the sandbox Signature Test tab or with a sandbox API call.
  3. When going live, repeat the process in production with a new key pair.

Troubleshooting

IssueWhat to do
API signature rejectedConfirm you clicked Save after generating; verify the private key matches the uploaded public key
Wrong environmentSandbox and production keys are separate — check toggle and Merchant ID prefix
Lost private keyGenerate a new pair, upload the new public key, and update your server
Public key box empty after GenerateRetry Generate; check browser download permissions