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
Tutorials
    • All tutorials
    • Differentiation of access permissions for user groups
    • Creating an L7 load balancer with a Smart Web Security security profile through an Application Load Balancer Ingress controller
    • Centralized online publication and app protection against DDoS attacks
    • Delivering logs from a VM instance to Cloud Logging
    • Writing load balancer logs to PostgreSQL
    • Secure storage of GitLab CI passwords as Yandex Lockbox secrets
    • Service account with an OS Login profile for VM management via Ansible
    • Transferring logs from Container Optimized Image to Cloud Logging
    • Adding an HTML page to work with SmartCaptcha
    • Creating an L7 load balancer with a security profile
    • Alert settings in Monitoring
    • Exporting audit logs to MaxPatrol SIEM
    • Exporting audit logs to SIEM Splunk systems
    • Uploading audit logs to ArcSight SIEM
      • 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
    • Server-side encryption for an Object Storage bucket
    • Encrypting secrets in Hashicorp Terraform
    • Managing KMS keys with Hashicorp Terraform
    • Auto Unseal in Hashicorp Vault

In this article:

  • Adding dependencies
  • Encryption and decryption
  1. Security
  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