Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Key Management Service
  • Getting started
    • All tutorials
      • Which encryption method should I choose?
      • Encrypting data using the Yandex Cloud CLI and API
      • Encrypting data using the Yandex Cloud SDK
      • Encrypting data using the AWS Encryption SDK
      • Encrypting data using Google Tink
    • Encrypting secrets in Managed Service for Kubernetes
    • Signing and verifying Docker images in Managed Service for Kubernetes
    • Managing KMS keys with Hashicorp Terraform
    • Encrypting secrets in Hashicorp Terraform
    • Auto Unseal in Hashicorp Vault
    • Secure password transmission to an initialization script
    • Server-side encryption for an Object Storage bucket
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • FAQ

In this article:

  • Adding dependencies
  • Encryption and decryption
  1. Tutorials
  2. Data encryption
  3. Encrypting data using the AWS Encryption SDK

Encrypting data using the AWS Encryption SDK

Written by
Yandex Cloud
Updated at March 3, 2025
  • Adding dependencies
  • Encryption and decryption

AWS Encryption SDK is a library that simplifies the process of encrypting and decrypting data. Use it if you want to securely encrypt data without going into the details of encryption algorithms.

With the Yandex Cloud provider for the AWS Encryption SDK, you can use the AWS Encryption SDK to encrypt and decrypt data in Yandex Key Management Service keys. Data is encrypted using envelope encryption (the size of plaintext is not limited). The provider is only supported for Java.

Adding dependenciesAdding dependencies

Before you start, you need to add dependencies.

Java

Add dependencies using Apache Maven:

<dependency>
    <groupId>com.yandex.cloud</groupId>
    <artifactId>kms-provider-awscrypto</artifactId>
    <version>2.1</version>
</dependency>

Encryption and decryptionEncryption and decryption

Create a Yandex Cloud provider for the AWS Encryption SDK and use the methods of the AwsCrypto class to encrypt and decrypt data.

Java
YcKmsMasterKeyProvider provider = new YcKmsMasterKeyProvider()
    .withEndpoint(endpoint)
    .withCredentials(credentialProvider)
    .withKeyId(keyId);
AwsCrypto awsCrypto = AwsCrypto.standard();

...

byte[] ciphertext = awsCrypto.encryptData(provider, plaintext, aad).getResult();

...

byte[] plaintext = awsCrypto.decryptData(provider, ciphertext).getResult();

Where:

  • endpoint: api.cloud.yandex.net:443.
  • credentials: Sets the authentication method. For more information, see Authentication in the Yandex Cloud SDK.
  • keyId: ID of the KMS key.
  • plaintext: Unencrypted text.
  • ciphertext: Ciphertext.
  • aad: AAD context.

See alsoSee also

  • AWS Encryption SDK
  • Yandex Cloud provider for the AWS Encryption SDK
  • Examples of using Yandex Cloud KMS Providers for the AWS Encryption SDK

Was the article helpful?

Previous
Encrypting data using the Yandex Cloud SDK
Next
Encrypting data using Google Tink
Yandex project
© 2025 Yandex.Cloud LLC