Decryption
Asymmetric cryptography will be used to ensure all payloads exchanged with the gateway are protected.
A public key for encryption needs to be shared with the bolttech API team. The bolttech API will then encrypt all responses with that public key, and it will only be decryptable using the matching private key.
No private keys will be shared, only public keys.
About the public keys
The Gateway consumer should create an RSA key pair:
Asym Cryptography Algo: RSA
Asym Cryptography key size: 2048 or 4096
Private keys should be kept in secure and offline storage. Public keys will be shared between teams.
Sample with Node.js
Decrypting Payload
Some of the bolttech API's responses will be encrypted for security reasons. Here's an example on how to decrypt this data:
const NodeRSA = require("node-rsa");
// Use private key from the [Generating Key Pair] example that will be generated once and safely stored locally
const key = new NodeRSA(privateKey);
// Here's is the encrypted response from the bolttech API
const encrypted =
"3rHECZcvGTRUxp8ijwCXfsBghWyXijeUeaKM7Hxgzcho0m/7C/T1QrdPxp9wtbeqP7QNGxyqBT5J6c7lo+IEvrMtp6Dd3r0BgY36dUAJomaOuE4Pp4Hsu/w0ufCwrjrBKnTZi1q8xPJM6Bd1SEPi2NnoB7...";
const decryptedString = key.decrypt(encrypted, "utf8");
const decryptedJSON = JSON.parse(decryptedString);
// This is the decrypted response
console.log("decrypted: ", decryptedJSON);