Skip to main content

GetPublicKey

Gets value of public key.

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

const AsymmetricGetPublicKeyRequest =
cloudApi.kms.asymmetricencryption_asymmetric_encryption_crypto_service
.AsymmetricGetPublicKeyRequest;

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

const result = await client.getPublicKey(
AsymmetricGetPublicKeyRequest.fromPartial({
keyId: "keyId",
})
);
console.log(result);
})();

AsymmetricGetPublicKeyRequest

keyId : string

ID of the asymmetric KMS key to be used for public key retrieval.

AsymmetricGetPublicKeyResponse

keyId : string

ID of the asymmetric KMS key to get public key of.

publicKey : string

Public key value. The value is a PEM-encoded X.509 public key, also known as SubjectPublicKeyInfo (SPKI), as defined in RFC 5280.