GetPublicKey
Gets value of public key.
- TypeScript
- Python
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);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.kms.v1.asymmetricencryption.asymmetric_encryption_crypto_service_pb2_grpc import (
AsymmetricEncryptionCryptoServiceStub,
)
from yandex.cloud.kms.v1.asymmetricencryption.asymmetric_encryption_crypto_service_pb2 import (
AsymmetricGetPublicKeyRequest,
)
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(AsymmetricEncryptionCryptoServiceStub)
response = service.GetPublicKey(AsymmetricGetPublicKeyRequest(key_id="keyId"))
print(response)
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.