
Important Notes:
Security: Generate keys on a secure machine. Never share or expose the private key.
PKCS#8 Format: This is a standard for encoding private keys.
Base64 Encoding: We'll encode the entire PEM public key (including headers like -----BEGIN PUBLIC KEY----- and footers) in base64 for transmission.
Libraries: Use cryptographic libraries in your language. Avoid implementing RSA from scratch.
Usage: After generation, use the public key in each request that requires it, and decrypt the results of document/download with the private key.
Create a 2048-bit RSA private key and derive the corresponding public key.
Ensure the private key is in PKCS#8 format.
Save the private key in PEM format to a file (e.g., private.pem).
Optionally, encrypt it with a passphrase for added security.
Export the public key in PEM format.
Base64-encode the entire PEM string.
This encoded string can be sent in the publicKey parameter of your API request body.
Include the base64-encoded public key in your HTTP request body, e.g. { "publicKey": "<base64_string>" }.
Use the private key for decryption operations (see “Document Decryption Guide”). LINK
Regenerate keys periodically or if compromised.
Validate keys after generation (e.g., check if they can encrypt/decrypt a test message).
Handle errors gracefully (e.g., invalid key formats).
For production, use hardware security modules (HSMs) for key storage.