Skip to main content

Decrypt

Decrypts the given ciphertext with the specified key.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const SymmetricDecryptRequest =
cloudApi.kms.symmetric_crypto_service.SymmetricDecryptRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.SymmetricCryptoServiceClient);

const result = await client.decrypt(
SymmetricDecryptRequest.fromPartial({
keyId: "keyId",
// aadContext: Buffer.from([]),
ciphertext: Buffer.from([]),
})
);
console.log(result);
})();

SymmetricDecryptRequest

keyId : string

ID of the symmetric KMS key to use for decryption.

aadContext : bytes

Additional authenticated data, must be the same as was provided in the corresponding SymmetricEncryptRequest. Should be encoded with base64.

ciphertext : bytes

Ciphertext to be decrypted. Should be encoded with base64.

SymmetricDecryptResponse

keyId : string

ID of the symmetric KMS key that was used for decryption.

versionId : string

ID of the key version that was used for decryption.

plaintext : bytes

Decrypted plaintext.