Certificates
What are Certificates?
When to Use Certificates?
Using Keys for Encryption and Decryption
// Get the tool configured for your specific key
const cipherTool = ascent.crypto.aes("your-certificate-key-name-in-vault");
const dataToProtect = { sensitiveInfo: "secret value", id: 123 };
// Encrypt the data
const encryptedString = cipherTool.encrypt(dataToProtect);
// encryptedString now holds the secure, encrypted version of your data
console.log(encryptedString); // Example output: "U2FsdGVkX1..."
const decryptedString = cipherTool.decrypt(encryptedString);
// decryptedString now holds the original data, represented as a string
console.log(decryptedString); // Example output: '{"sensitiveInfo":"secret value","id":123}'
Last updated
Was this helpful?