Sign
Signs data specified KMS key.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const AsymmetricSignRequest =
cloudApi.kms.asymmetricsignature_asymmetric_signature_crypto_service
.AsymmetricSignRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(
serviceClients.AsymmetricSignatureCryptoServiceClient
);
const result = await client.sign(
AsymmetricSignRequest.fromPartial({
keyId: "keyId",
message: Buffer.from([]),
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.kms.v1.asymmetricsignature.asymmetric_signature_crypto_service_pb2 import (
AsymmetricSignRequest,
)
from yandex.cloud.kms.v1.asymmetricsignature.asymmetric_signature_crypto_service_pb2_grpc import (
AsymmetricSignatureCryptoServiceStub,
)
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(AsymmetricSignatureCryptoServiceStub)
response = service.Sign(AsymmetricSignRequest(key_id="keyId", message=b""))
print(response)
AsymmetricSignRequest
keyId
: string
ID of the asymmetric KMS key to use for signature.
message
: bytes
Message to sign. Should be encoded with base64.
AsymmetricSignResponse
keyId
: string
ID of the asymmetric KMS key that was used for signature.
signature
: bytes
Value of signature. Signature value is produced in accordance with RFC 8017 for RSA and is a DER-encoded object as defined by ANSI X9.62-2005 and RFC 3279 Section 2.2.3 for ECDSA.