Skip to main content

Decrypt

Decrypts the given ciphertext with the specified key.

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

const AsymmetricDecryptRequest =
cloudApi.kms.asymmetricencryption_asymmetric_encryption_crypto_service
.AsymmetricDecryptRequest;

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

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

AsymmetricDecryptRequest

keyId : string

ID of the asymmetric KMS key to use for decryption.

ciphertext : bytes

Ciphertext to be decrypted. Should be encoded with base64.

AsymmetricDecryptResponse

keyId : string

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

plaintext : bytes

Decrypted plaintext.