Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Key Management Service
  • Getting started
    • All guides
      • Digital signature key pair
      • Access permissions for a digital signature key pair
      • Digital signature and its verification
      • Signing files and artifacts digitally using Cosign
    • Viewing service resource operations
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • FAQ

In this article:

  • Getting started
  • Sign a local file
  • Verify the digital signature
  1. Step-by-step guides
  2. Digital signature
  3. Signing files and artifacts digitally using Cosign

Signing files and artifacts digitally using Cosign

Written by
Yandex Cloud
Updated at September 29, 2026
View as Markdown
  • Getting started
  • Sign a local file
  • Verify the digital signature

In Key Management Service, you can use digital signature key pairs created with Cosign. A special build of Cosign enables you to store the created digital signature key pair in KMS, sign files and artifacts with the private key, and verify the digital signature with its public key.

Getting startedGetting started

  1. Install the appropriate version of Cosign for your operating system:

    • Linux amd64
    • MacOS Darwin amd64
    • MacOS Darwin arm64
    • Windows
  2. Get an IAM token and save it to the $YC_IAM_TOKEN environment variable:

    Bash
    PowerShell
    export YC_IAM_TOKEN=$(yc iam create-token)
    
    $env:YC_IAM_TOKEN = $(yc iam create-token)
    

Sign a local fileSign a local file

  1. Create a digital signature key pair in KMS and save it:

    cosign generate-key-pair \
      --kms yckms:///folder/<folder_ID>/keyname/<key_pair_name>
    

    Where:

    • <folder_ID>: ID of the folder to save the new key pair to.
    • <key_pair_name>: Name of the signature key pair you are creating.

    Result:

    client.go:183: Using IAM Token from 'YC_IAM_TOKEN' environment variable as credentials
    client.go:310: generated yckms KEY_ID: 'abj15qhhh98d********'
    Public key written to cosign.pub
    

    The utility will return the ID of the created signature key pair and save the public signature key to a local file. Save the key pair ID, as you will need it in the next steps.

    You can always get the ID of your signature key pair in the management console or using the CLI command.

  2. Sign a local file:

    cosign sign-blob \
      --key yckms:///<key_pair_ID> \
      --tlog-upload=false \
      <file_path>
    

    Where:

    • <key_pair_ID>: Signature key pair ID you got in the previous step.
    • <path_to_file>: Path to the local file to sign.

    Result:

    Using payload from: <file_path>
    client.go:183: Using IAM Token from 'YC_IAM_TOKEN' environment variable as credentials
    <digital_signature_value>
    

    Save the digital signature value. You will need it for signature verification in the next step.

Verify the digital signatureVerify the digital signature

To verify your signature, run the following command:

cosign verify-blob \
  --key yckms:///<key_pair_ID> \
  --insecure-ignore-tlog \
  --signature "<digital_signature_value>" \
  <file_path>

Where:

  • --key: Signature key pair ID obtained earlier.
  • --signature: Digital signature value obtained in the previous step.
  • <path_to_file>: Path to the local file whose signature you want to verify.

Result:

WARNING: Skipping tlog verification is an insecure practice that lacks of transparency and auditability verification for the blob.
client.go:183: Using IAM Token from 'YC_IAM_TOKEN' environment variable as credentials
Verified OK

Useful linksUseful links

Signing and verifying Container Registry Docker images in Managed Service for Kubernetes

Was the article helpful?

Previous
Digital signature and its verification
Next
Viewing service resource operations
© 2026 Direct Cursus Technology L.L.C.