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
Security in Yandex Cloud
  • Key security principles
  • Division of responsibility
  • Compliance
  • Security measures on the Yandex Cloud side
  • Security tools available to cloud service users
    • 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
      • Managing Key Management Service keys with Terraform
      • Encrypting secrets in Terraform
      • Auto Unseal in Hashicorp Vault
      • Secure password transmission to an initialization script
      • Secure storage of GitLab CI passwords as Yandex Lockbox secrets
      • Getting Yandex Lockbox secret value on the GitHub side
      • Getting Yandex Lockbox secret value on the GitLab side
  • User support policy during vulnerability scanning
  • Security bulletins
  • Public IP address ranges

In this article:

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

Encrypting data using the AWS Encryption SDK

Written by
Yandex Cloud
Updated at March 31, 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