SlideShare a Scribd company logo
1 of 48
Download to read offline
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using the AWS Encryption SDK for
multiple master key encryption
Jamie Angell
Sr. Manager, Software
Development
AWS Cryptography
Amazon Web Services
S D D 4 0 2
Ryan Emery
Senior Software Engineer
AWS Cryptography
Amazon Web Services
Liz Roth
Senior Software Engineer
Amazon Web Services
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Quick primer on encryption
Quick primer on AWS Key Management Service (AWS KMS)
Intro to the AWS Encryption SDK
Adding encryption to an application
Implementing data key caching in your application
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basic definitions
Plaintext CiphertextData Key
Encryption
Algorithm
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encryption
Encryption Algorithm
Plaintext
Ciphertext
Data Key
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Decryption
Plaintext
Ciphertext
Data Key
Decryption Algorithm
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Don’t roll your own crypto
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Keys
Small
High value
Easily exfiltrated
Require additional protection
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Key Management Service
Traditional web service with web APIs
integrated with other Amazon Web
Services (AWS) services
Backed by hardware security modules
(HSMs)
Non-exportable keys called customer
master keys (CMKs)
KMS
KMSFleet HSMs
CMKARNs
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS KMS
KMS
GenerateDataKey
Data
Key
Encrypted
Data Key
HSMs
CMK
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
KMS access control
KMSGenerateDataKey
CMK
Access Denied
GenerateDataKey
CloudTrail Log
CloudTrail Log AWSCloudTrail
Key Policies
Granting Access
Key Policies
Preventing Access
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypting with AWS KMS
Encrypt API
{
"KeyId": "string",
"EncryptionContext":
{ "string" : "string" },
"Plaintext": blob
}
Result
{
"KeyId": "string"
"CiphertextBlob": blob,
}
If the ciphertext blob or the encryption context is changed,
requests to decrypt the data will fail
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Decrypting with AWS KMS
Decrypt API
{
"EncryptionContext":
{ "string" : "string" },
"CiphertextBlob": blob
}
Result
{
"KeyId": "string"
"Plaintext": blob,
}
If the ciphertext blob or the encryption context is changed,
requests to decrypt the data will fail
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Non-secret, plaintext additional information
Should be relevant to the data
Included in CloudTrail logs in plaintext
Can be used as conditions in IAM policies, key
policies, and grants
Examples:
Document type, security classification,
customer ID, date stamps, order IDs, etc.
Balance plaintext disclosure with audit/access
control detail
{
"awsRegion": "us-east-2",
"eventName": "Decrypt",
"eventSource": "kms.amazonaws.com",
"eventTime": "2017-09-15T19:35:54Z",
"requestParameters": {
"encryptionContext": {
"TenantID": ”123AID",
"OrderDate": "2018-09-01",
"OrderID": "123-4567890-011",
"Type": "Invoice"
}
},
// ...
}
Encryption context
Encryption
Context
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encryption context – Why it matters
good.txt bad.txt
good.txt
bad.txt
bad.txt
good.txt
Decryption succeeds ☺
Decryption succeeds 
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encryption context – Why it matters
good.txt bad.txt
good.txt
bad.txt
bad.txt
good.txt
good.txt
NAME=“GOOD.TXT”
bad.txt
NAME=“BAD.TXT”
bad.txt
good.txt
NAME=“BAD.TXT”
good.txt
bad.txt
NAME=“GOOD.TXT”
Decryption succeeds ☺
Decryption succeeds 
Decryption succeeds ☺
Decryption fails ☺
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS KMS direct-encrypt considerations
Plaintext message is limited to 4,096 bytes
Plaintext is sent to AWS KMS (over TLS) before being encrypted by the AWS
KMS HSMs
You must call AWS KMS for every encrypt and
decrypt operation
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Envelope Encryption With KMS
Have KMS generate a limited-scope data key
Encrypt the data key using AWS KMS or an HSM
Encrypt the plaintext using the data key
Store or transmit the encrypted data key
and the ciphertext
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypted
data key
Encrypted
data
Plaintext data
Encrypted message
Key encryption key
(CMK)
Data key Encryption
algorithm
Encryption
algorithm
Envelope encryption
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Benefits of envelope encryption
Scales with the number of messages you encrypt
Can encrypt very large messages
Efficiently encrypts a message that can be decrypted by multiple recipients
Data key can be cached and used across multiple messages
Reduces calls to AWS KMS
Reduces latency
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Complexities of envelope encryption
Several moving parts to build
Carefully select algorithms in use
Make sure you get everything right
Don’t reuse IVs
Generate keys correctly
Keep track of encryption context
Design a data format to store required parameters
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
The AWS Encryption SDK
• Framework and data format for client-side encryption
• Library that gives you authenticated envelope encryption
• Backed by AWS KMS or external key sources
• Implementations available for Java, Python, and C
• Specification is available if you want to implement in a different
language
• Supports data-key caching
• Open source under Apache 2.0 license
• Built on language-specific crypto primitives
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Data format
• Bundles all the information needed to perform the decryption except the
backing key
• Includes the plaintext encryption context
• Includes information that validates integrity of
the ciphertext and encryption context
AWSEncryptionSDK
messageformat
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why is this useful?
Makes it easy to use AWS KMS
It does the hard stuff, so you can focus on your application
Available as an open-source library
Available in Java, Python, C, and CLI—all interoperable
Documented message format
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Master keys and master key providers
Master keys
Control access to data
Correspond to AWS KMS CMKs
Master key providers
Decide which master keys to use
In general
Use AWS KMS
You can integrate with other key material sources
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Support for data-key caching
Security/performance trade-off
Missing key use detail in audit logs
Need identical encryption contexts and keys
Greater potential impact if a key is
ever compromised
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypting with the AWS Encryption SDK
AWSKMS
Encrypted data
Customermaster key(CMK)
AWSEncryptionSDK
Encrypteddatakey
GenerateDataKey
EncryptioncontextPlaintextdata
Encryptedmessage
Datakey
CMK ARN
Encryption
algorithm
AWSEncryptionSDK
messageformat
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypting with multiple master keys
CMKus-east-1
AWSEncryptionSDKGenerateDataKey
Datakey
CMKeu-west-1
Encrypteddatakeyeu-west-1
Encrypteddatakeyus-
east-1
Encrypt
EncryptioncontextPlaintext data
Encrypted data
Encryptedmessage
Encryption
algorithm
AWSEncryptionSDK
messageformat
CMKARN eu-west-1 CMKARN us-east-1
KMS us-east-1
KMS eu-west -1
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Decrypting in us-east-1
AWSEncryptionSDK
Datakey
Encryptioncontext
Plaintext data
Encrypted data
Encryptedmessage
Datakey
Decrypt
Decryptionalgorithm
AWSEncryptionSDK
messageformat
CMKus-east-1
Encrypteddatakeyus-east-1
CMKARN us-east-1
KMS us-east-1
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Decrypting in eu-west-1
Datakey
Encryptioncontext
Plaintext data
Encrypted data
Encryptedmessage
Datakey
Decrypt
Decryptionalgorithm
AWSEncryptionSDK
messageformat
CMKARN eu-west-1
CMKeu-west-1
Encrypteddatakeyeu-west-1
AWSEncryptionSDK
KMS eu-west -1
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
public static void main(String[] args) {
KmsMasterKeyProvider mkp = new KmsMasterKeyProvider("alias/myExampleKey");
byte[] myData = "Hello World!".getBytes(StandardCharsets.UTF_8);
Map<String, String> encryptionContext = new Map<String, String>;
encryptionContext.put("data_type", "example");
encryptionContext.put("classification", "public");
byte[] ciphertext = new AwsCrypto()
.encryptData(mkp, myData, encryptionContext).getResult();
byte[] plaintext = new AwsCrypto()
.decryptData(mkp, ciphertext).getResult();
System.out.println(new String(myData, StandardCharsets.UTF_8));
}
The AWS Encryption SDK (Java)
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
def encrypt_this():
plaintext = "Hello World!"
mkp = KMSMasterKeyProvider(
key_ids=["alias/myExampleKey"]
)
encryption_context = {
"data_type": "example",
"classification": "public",
}
ciphertext, encryptor_header = aws_encryption_sdk.encrypt(
source=plaintext,
key_provider=mkp,
encryption_context=encryption_context,
)
decrypted_plaintext, decryptor_header = aws_encryption_sdk.decrypt(
source=ciphertext,
key_provider=mkp,
)
print(decrypted_plaintext.decode("utf-8"))
The AWS Encryption SDK (Python)
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
echo "Hello World!" > plaintext
aws-encryption-cli 
--encrypt 
--master-keys 
provider=aws-kms 
key=alias/myExampleKey 
--encryption-context 
"data_type=example" 
"classification=public" 
--metadata-output - 
--input plaintext 
--output ciphertext
aws-encryption-cli 
--decrypt 
--metadata-output - 
--input ciphertext 
--output decrypted-plaintext
cat decrypted-plaintext
The AWS Encryption SDK (CLI)
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Set up the demo application
Activity
busy-engineers-guide.reinvent-workshop.com
Environment setup
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Explore and add Base64 encoding to your application
Activity
busy-engineers-guide.reinvent-workshop.com
Exercise 1: Explore
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypt directly with AWS KMS
Activity
busy-engineers-guide.reinvent-workshop.com
Exercise 2: Introducing KMS
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using the AWS Encryption SDK
Activity
busy-engineers-guide.reinvent-workshop.com
Exercise 3: The AWS Encryption SDK
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Add data key caching to your application
Activity
busy-engineers-guide.reinvent-workshop.com
Exercise 4: Data Key Caching
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Add data key caching to your application
Activity
busy-engineers-guide.reinvent-workshop.com
Exercise 5: Using Multiple CMKs
Thank you!
© 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Jamie Angell
Sr. Manager, Software
Development
AWS Cryptography
Amazon Web Services
Ryan Emery
Senior Software Engineer
AWS Cryptography
Amazon Web Services
Liz Roth
Senior Software Engineer
Amazon Web Services

More Related Content

What's hot

Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...
Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...
Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...Edureka!
 
AWS Storage - S3 Fundamentals
AWS Storage - S3 FundamentalsAWS Storage - S3 Fundamentals
AWS Storage - S3 FundamentalsPiyush Agrawal
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaAmazon Web Services
 
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...Amazon Web Services
 
Azure container instances
Azure container instancesAzure container instances
Azure container instancesKarthikeyan VK
 
Content Delivery Using Amazon CloudFront - AWS Presentation - John Mancuso
Content Delivery Using Amazon CloudFront - AWS Presentation - John MancusoContent Delivery Using Amazon CloudFront - AWS Presentation - John Mancuso
Content Delivery Using Amazon CloudFront - AWS Presentation - John MancusoAmazon Web Services
 
Encryption and Key Management in AWS
Encryption and Key Management in AWS Encryption and Key Management in AWS
Encryption and Key Management in AWS Amazon Web Services
 
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatchAmazon Web Services
 
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...Simplilearn
 
Understanding the New Content Modeling Framework
Understanding the New Content Modeling FrameworkUnderstanding the New Content Modeling Framework
Understanding the New Content Modeling FrameworkAras
 
Introduction to AWS Cost Management
Introduction to AWS Cost ManagementIntroduction to AWS Cost Management
Introduction to AWS Cost ManagementAmazon Web Services
 
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...Simplilearn
 
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...Amazon Web Services Korea
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)Ashish Kushwaha
 
Training AWS: Module 6 - Storage S3 in AWS
Training AWS: Module 6 - Storage S3 in AWSTraining AWS: Module 6 - Storage S3 in AWS
Training AWS: Module 6 - Storage S3 in AWSBùi Quang Lâm
 
Module 3 - QuickSight Overview
Module 3 - QuickSight OverviewModule 3 - QuickSight Overview
Module 3 - QuickSight OverviewLam Le
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture PatternsAmazon Web Services
 

What's hot (20)

Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...
Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...
Amazon CloudWatch Tutorial | AWS Certification | Cloud Monitoring Tools | AWS...
 
AWS Cloud Watch
AWS Cloud WatchAWS Cloud Watch
AWS Cloud Watch
 
AWS Storage - S3 Fundamentals
AWS Storage - S3 FundamentalsAWS Storage - S3 Fundamentals
AWS Storage - S3 Fundamentals
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS Lambda
 
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...
AWS Networking – Advanced Concepts and new capabilities | AWS Summit Tel Aviv...
 
Azure container instances
Azure container instancesAzure container instances
Azure container instances
 
Content Delivery Using Amazon CloudFront - AWS Presentation - John Mancuso
Content Delivery Using Amazon CloudFront - AWS Presentation - John MancusoContent Delivery Using Amazon CloudFront - AWS Presentation - John Mancuso
Content Delivery Using Amazon CloudFront - AWS Presentation - John Mancuso
 
Encryption and Key Management in AWS
Encryption and Key Management in AWS Encryption and Key Management in AWS
Encryption and Key Management in AWS
 
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
 
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
AWS S3 | Tutorial For Beginners | AWS S3 Bucket Tutorial | AWS Tutorial For B...
 
Cost Optimisation on AWS
Cost Optimisation on AWSCost Optimisation on AWS
Cost Optimisation on AWS
 
Understanding the New Content Modeling Framework
Understanding the New Content Modeling FrameworkUnderstanding the New Content Modeling Framework
Understanding the New Content Modeling Framework
 
Introduction to AWS Cost Management
Introduction to AWS Cost ManagementIntroduction to AWS Cost Management
Introduction to AWS Cost Management
 
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Be...
 
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
 
Training AWS: Module 6 - Storage S3 in AWS
Training AWS: Module 6 - Storage S3 in AWSTraining AWS: Module 6 - Storage S3 in AWS
Training AWS: Module 6 - Storage S3 in AWS
 
What is AWS Cloud Watch
What is AWS Cloud WatchWhat is AWS Cloud Watch
What is AWS Cloud Watch
 
Module 3 - QuickSight Overview
Module 3 - QuickSight OverviewModule 3 - QuickSight Overview
Module 3 - QuickSight Overview
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 

Similar to Using the AWS Encryption SDK for multiple master key encryption - SDD402 - AWS re:Inforce 2019

AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...
AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...
AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...Amazon Web Services
 
Data protection using encryption in AWS - SEC201 - Santa Clara AWS Summit
Data protection using encryption in AWS - SEC201 - Santa Clara AWS SummitData protection using encryption in AWS - SEC201 - Santa Clara AWS Summit
Data protection using encryption in AWS - SEC201 - Santa Clara AWS SummitAmazon Web Services
 
How encryption works in AWS: What assurances do you have that unauthorized us...
How encryption works in AWS: What assurances do you have that unauthorized us...How encryption works in AWS: What assurances do you have that unauthorized us...
How encryption works in AWS: What assurances do you have that unauthorized us...Amazon Web Services
 
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side Encryption
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side EncryptionSID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side Encryption
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side EncryptionAmazon Web Services
 
Getting Started with AWS Security
Getting Started with AWS SecurityGetting Started with AWS Security
Getting Started with AWS SecurityAmazon Web Services
 
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019 The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019 Amazon Web Services
 
AWS Security and Encryption
AWS Security and EncryptionAWS Security and Encryption
AWS Security and EncryptionRichard Harvey
 
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019 Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019 Amazon Web Services
 
Best Practices for Encrypting Data on AWS
Best Practices for Encrypting Data on AWSBest Practices for Encrypting Data on AWS
Best Practices for Encrypting Data on AWSAmazon Web Services
 
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...Securing Data in Serverless Applications and Messaging Services (API317-R2) -...
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...Amazon Web Services
 
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...Amazon Web Services
 
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019 Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019 Amazon Web Services
 
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018Amazon Web Services
 
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018Amazon Web Services
 
Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019Devoteam Revolve
 
AWS PROTECTED Certification - Lunch & Learn
  AWS PROTECTED Certification - Lunch & Learn  AWS PROTECTED Certification - Lunch & Learn
AWS PROTECTED Certification - Lunch & LearnAmazon Web Services
 
Sicurezza in AWS automazione e best practice
Sicurezza in AWS automazione e best practiceSicurezza in AWS automazione e best practice
Sicurezza in AWS automazione e best practiceAmazon Web Services
 
Using AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsUsing AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsAmazon Web Services
 

Similar to Using the AWS Encryption SDK for multiple master key encryption - SDD402 - AWS re:Inforce 2019 (20)

AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...
AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...
AWS Encryption SDK: The Busy Engineer's Guide to Client-Side Encryption (SEC3...
 
Data protection using encryption in AWS - SEC201 - Santa Clara AWS Summit
Data protection using encryption in AWS - SEC201 - Santa Clara AWS SummitData protection using encryption in AWS - SEC201 - Santa Clara AWS Summit
Data protection using encryption in AWS - SEC201 - Santa Clara AWS Summit
 
How encryption works in AWS: What assurances do you have that unauthorized us...
How encryption works in AWS: What assurances do you have that unauthorized us...How encryption works in AWS: What assurances do you have that unauthorized us...
How encryption works in AWS: What assurances do you have that unauthorized us...
 
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side Encryption
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side EncryptionSID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side Encryption
SID345-AWS Encryption SDK The Busy Engineer’s Guide to Client-Side Encryption
 
Getting Started with AWS Security
Getting Started with AWS SecurityGetting Started with AWS Security
Getting Started with AWS Security
 
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019 The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019
The fundamentals of AWS cloud security - FND209-R - AWS re:Inforce 2019
 
AWS Security and Encryption
AWS Security and EncryptionAWS Security and Encryption
AWS Security and Encryption
 
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019 Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019
Achieving security goals with AWS CloudHSM - SDD333 - AWS re:Inforce 2019
 
AWS
AWSAWS
AWS
 
Best Practices for Encrypting Data on AWS
Best Practices for Encrypting Data on AWSBest Practices for Encrypting Data on AWS
Best Practices for Encrypting Data on AWS
 
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...Securing Data in Serverless Applications and Messaging Services (API317-R2) -...
Securing Data in Serverless Applications and Messaging Services (API317-R2) -...
 
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...
How to Secure Sensitive Customer Data Using Amazon CloudFront - AWS Online Te...
 
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019 Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019
Data encryption concepts in AWS - FND302 - AWS re:Inforce 2019
 
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
 
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
 
Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019
 
AWS - Security & Compliance
AWS - Security & ComplianceAWS - Security & Compliance
AWS - Security & Compliance
 
AWS PROTECTED Certification - Lunch & Learn
  AWS PROTECTED Certification - Lunch & Learn  AWS PROTECTED Certification - Lunch & Learn
AWS PROTECTED Certification - Lunch & Learn
 
Sicurezza in AWS automazione e best practice
Sicurezza in AWS automazione e best practiceSicurezza in AWS automazione e best practice
Sicurezza in AWS automazione e best practice
 
Using AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsUsing AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure Workloads
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Using the AWS Encryption SDK for multiple master key encryption - SDD402 - AWS re:Inforce 2019

  • 1. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Using the AWS Encryption SDK for multiple master key encryption Jamie Angell Sr. Manager, Software Development AWS Cryptography Amazon Web Services S D D 4 0 2 Ryan Emery Senior Software Engineer AWS Cryptography Amazon Web Services Liz Roth Senior Software Engineer Amazon Web Services
  • 2. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Quick primer on encryption Quick primer on AWS Key Management Service (AWS KMS) Intro to the AWS Encryption SDK Adding encryption to an application Implementing data key caching in your application
  • 3. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 4. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Basic definitions Plaintext CiphertextData Key Encryption Algorithm
  • 5. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encryption Encryption Algorithm Plaintext Ciphertext Data Key
  • 6. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Decryption Plaintext Ciphertext Data Key Decryption Algorithm
  • 7. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Don’t roll your own crypto
  • 8. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Keys Small High value Easily exfiltrated Require additional protection
  • 9. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 10. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Key Management Service Traditional web service with web APIs integrated with other Amazon Web Services (AWS) services Backed by hardware security modules (HSMs) Non-exportable keys called customer master keys (CMKs) KMS KMSFleet HSMs CMKARNs
  • 11. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS KMS KMS GenerateDataKey Data Key Encrypted Data Key HSMs CMK
  • 12. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. KMS access control KMSGenerateDataKey CMK Access Denied GenerateDataKey CloudTrail Log CloudTrail Log AWSCloudTrail Key Policies Granting Access Key Policies Preventing Access
  • 13. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encrypting with AWS KMS Encrypt API { "KeyId": "string", "EncryptionContext": { "string" : "string" }, "Plaintext": blob } Result { "KeyId": "string" "CiphertextBlob": blob, } If the ciphertext blob or the encryption context is changed, requests to decrypt the data will fail
  • 14. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Decrypting with AWS KMS Decrypt API { "EncryptionContext": { "string" : "string" }, "CiphertextBlob": blob } Result { "KeyId": "string" "Plaintext": blob, } If the ciphertext blob or the encryption context is changed, requests to decrypt the data will fail
  • 15. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Non-secret, plaintext additional information Should be relevant to the data Included in CloudTrail logs in plaintext Can be used as conditions in IAM policies, key policies, and grants Examples: Document type, security classification, customer ID, date stamps, order IDs, etc. Balance plaintext disclosure with audit/access control detail { "awsRegion": "us-east-2", "eventName": "Decrypt", "eventSource": "kms.amazonaws.com", "eventTime": "2017-09-15T19:35:54Z", "requestParameters": { "encryptionContext": { "TenantID": ”123AID", "OrderDate": "2018-09-01", "OrderID": "123-4567890-011", "Type": "Invoice" } }, // ... } Encryption context Encryption Context
  • 16. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encryption context – Why it matters good.txt bad.txt good.txt bad.txt bad.txt good.txt Decryption succeeds ☺ Decryption succeeds 
  • 17. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encryption context – Why it matters good.txt bad.txt good.txt bad.txt bad.txt good.txt good.txt NAME=“GOOD.TXT” bad.txt NAME=“BAD.TXT” bad.txt good.txt NAME=“BAD.TXT” good.txt bad.txt NAME=“GOOD.TXT” Decryption succeeds ☺ Decryption succeeds  Decryption succeeds ☺ Decryption fails ☺
  • 18. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS KMS direct-encrypt considerations Plaintext message is limited to 4,096 bytes Plaintext is sent to AWS KMS (over TLS) before being encrypted by the AWS KMS HSMs You must call AWS KMS for every encrypt and decrypt operation
  • 19. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Envelope Encryption With KMS Have KMS generate a limited-scope data key Encrypt the data key using AWS KMS or an HSM Encrypt the plaintext using the data key Store or transmit the encrypted data key and the ciphertext
  • 20. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encrypted data key Encrypted data Plaintext data Encrypted message Key encryption key (CMK) Data key Encryption algorithm Encryption algorithm Envelope encryption
  • 21. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Benefits of envelope encryption Scales with the number of messages you encrypt Can encrypt very large messages Efficiently encrypts a message that can be decrypted by multiple recipients Data key can be cached and used across multiple messages Reduces calls to AWS KMS Reduces latency
  • 22. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Complexities of envelope encryption Several moving parts to build Carefully select algorithms in use Make sure you get everything right Don’t reuse IVs Generate keys correctly Keep track of encryption context Design a data format to store required parameters
  • 23. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 24. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. The AWS Encryption SDK • Framework and data format for client-side encryption • Library that gives you authenticated envelope encryption • Backed by AWS KMS or external key sources • Implementations available for Java, Python, and C • Specification is available if you want to implement in a different language • Supports data-key caching • Open source under Apache 2.0 license • Built on language-specific crypto primitives
  • 25. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Data format • Bundles all the information needed to perform the decryption except the backing key • Includes the plaintext encryption context • Includes information that validates integrity of the ciphertext and encryption context AWSEncryptionSDK messageformat
  • 26. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Why is this useful? Makes it easy to use AWS KMS It does the hard stuff, so you can focus on your application Available as an open-source library Available in Java, Python, C, and CLI—all interoperable Documented message format
  • 27. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Master keys and master key providers Master keys Control access to data Correspond to AWS KMS CMKs Master key providers Decide which master keys to use In general Use AWS KMS You can integrate with other key material sources
  • 28. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Support for data-key caching Security/performance trade-off Missing key use detail in audit logs Need identical encryption contexts and keys Greater potential impact if a key is ever compromised
  • 29. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encrypting with the AWS Encryption SDK AWSKMS Encrypted data Customermaster key(CMK) AWSEncryptionSDK Encrypteddatakey GenerateDataKey EncryptioncontextPlaintextdata Encryptedmessage Datakey CMK ARN Encryption algorithm AWSEncryptionSDK messageformat
  • 30. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encrypting with multiple master keys CMKus-east-1 AWSEncryptionSDKGenerateDataKey Datakey CMKeu-west-1 Encrypteddatakeyeu-west-1 Encrypteddatakeyus- east-1 Encrypt EncryptioncontextPlaintext data Encrypted data Encryptedmessage Encryption algorithm AWSEncryptionSDK messageformat CMKARN eu-west-1 CMKARN us-east-1 KMS us-east-1 KMS eu-west -1
  • 31. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Decrypting in us-east-1 AWSEncryptionSDK Datakey Encryptioncontext Plaintext data Encrypted data Encryptedmessage Datakey Decrypt Decryptionalgorithm AWSEncryptionSDK messageformat CMKus-east-1 Encrypteddatakeyus-east-1 CMKARN us-east-1 KMS us-east-1
  • 32. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Decrypting in eu-west-1 Datakey Encryptioncontext Plaintext data Encrypted data Encryptedmessage Datakey Decrypt Decryptionalgorithm AWSEncryptionSDK messageformat CMKARN eu-west-1 CMKeu-west-1 Encrypteddatakeyeu-west-1 AWSEncryptionSDK KMS eu-west -1
  • 33. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. public static void main(String[] args) { KmsMasterKeyProvider mkp = new KmsMasterKeyProvider("alias/myExampleKey"); byte[] myData = "Hello World!".getBytes(StandardCharsets.UTF_8); Map<String, String> encryptionContext = new Map<String, String>; encryptionContext.put("data_type", "example"); encryptionContext.put("classification", "public"); byte[] ciphertext = new AwsCrypto() .encryptData(mkp, myData, encryptionContext).getResult(); byte[] plaintext = new AwsCrypto() .decryptData(mkp, ciphertext).getResult(); System.out.println(new String(myData, StandardCharsets.UTF_8)); } The AWS Encryption SDK (Java)
  • 34. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. def encrypt_this(): plaintext = "Hello World!" mkp = KMSMasterKeyProvider( key_ids=["alias/myExampleKey"] ) encryption_context = { "data_type": "example", "classification": "public", } ciphertext, encryptor_header = aws_encryption_sdk.encrypt( source=plaintext, key_provider=mkp, encryption_context=encryption_context, ) decrypted_plaintext, decryptor_header = aws_encryption_sdk.decrypt( source=ciphertext, key_provider=mkp, ) print(decrypted_plaintext.decode("utf-8")) The AWS Encryption SDK (Python)
  • 35. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. echo "Hello World!" > plaintext aws-encryption-cli --encrypt --master-keys provider=aws-kms key=alias/myExampleKey --encryption-context "data_type=example" "classification=public" --metadata-output - --input plaintext --output ciphertext aws-encryption-cli --decrypt --metadata-output - --input ciphertext --output decrypted-plaintext cat decrypted-plaintext The AWS Encryption SDK (CLI)
  • 36. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 37. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Set up the demo application Activity busy-engineers-guide.reinvent-workshop.com Environment setup
  • 38. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 39. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Explore and add Base64 encoding to your application Activity busy-engineers-guide.reinvent-workshop.com Exercise 1: Explore
  • 40. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 41. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Encrypt directly with AWS KMS Activity busy-engineers-guide.reinvent-workshop.com Exercise 2: Introducing KMS
  • 42. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 43. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Using the AWS Encryption SDK Activity busy-engineers-guide.reinvent-workshop.com Exercise 3: The AWS Encryption SDK
  • 44. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 45. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Add data key caching to your application Activity busy-engineers-guide.reinvent-workshop.com Exercise 4: Data Key Caching
  • 46. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 47. © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Add data key caching to your application Activity busy-engineers-guide.reinvent-workshop.com Exercise 5: Using Multiple CMKs
  • 48. Thank you! © 2019,Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you! Jamie Angell Sr. Manager, Software Development AWS Cryptography Amazon Web Services Ryan Emery Senior Software Engineer AWS Cryptography Amazon Web Services Liz Roth Senior Software Engineer Amazon Web Services