@@ -14,7 +14,7 @@ Getting Started
14
14
Required Prerequisites
15
15
======================
16
16
17
- * Python 2.7+ or 3.x
17
+ * Python 2.7+ or 3.4+
18
18
* cryptography >= 1.8.1
19
19
* boto3
20
20
* attrs
@@ -28,7 +28,7 @@ Installation
28
28
detailed in the `cryptography installation guide `_ for your operating system.
29
29
30
30
.. code ::
31
-
31
+
32
32
$ pip install aws-encryption-sdk
33
33
34
34
Concepts
@@ -44,7 +44,7 @@ An example of a CMM is the default CMM, which is automatically generated anywher
44
44
key provider. The default CMM collects encrypted data keys from all master keys referenced by the master key
45
45
provider.
46
46
47
- An example of a more advanced CMM is the caching CMM, which caches cryptographic materials provided by another CMM.
47
+ An example of a more advanced CMM is the caching CMM, which caches cryptographic materials provided by a another CMM.
48
48
49
49
Master Key Providers
50
50
--------------------
@@ -57,13 +57,12 @@ To encrypt data in this client, a ``MasterKeyProvider`` object must contain at l
57
57
58
58
Master Keys
59
59
-----------
60
- Master keys generate, encrypt, and decrypt data keys.
60
+ Master keys provide data keys.
61
61
An example of a master key is a `KMS customer master key (CMK) `_.
62
62
63
63
Data Keys
64
64
---------
65
- Data keys are the encryption keys that are used to encrypt your data. If your algorithm suite
66
- uses a key derivation function, the data key is used to generate the key that directly encrypts the data.
65
+ Data Keys are the actual encryption keys which are used to encrypt your data.
67
66
68
67
*****
69
68
Usage
@@ -83,9 +82,9 @@ you want to reuse an existing instance of a botocore session in order to decreas
83
82
84
83
import aws_encryption_sdk
85
84
import botocore.session
86
-
85
+
87
86
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider()
88
-
87
+
89
88
existing_botocore_session = botocore.session.Session()
90
89
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(botocore_session = existing_botocore_session)
91
90
@@ -98,7 +97,7 @@ will include a copy of the data key encrypted by each configured CMK.
98
97
.. code :: python
99
98
100
99
import aws_encryption_sdk
101
-
100
+
102
101
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids = [
103
102
' arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222' ,
104
103
' arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
@@ -109,7 +108,7 @@ You can add CMKs from multiple regions to the ``KMSMasterKeyProvider``.
109
108
.. code :: python
110
109
111
110
import aws_encryption_sdk
112
-
111
+
113
112
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids = [
114
113
' arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222' ,
115
114
' arn:aws:kms:us-west-2:3333333333333:key/33333333-3333-3333-3333-333333333333' ,
@@ -125,23 +124,23 @@ high-level ``encrypt``/``decrypt`` functions to encrypt and decrypt your data.
125
124
.. code :: python
126
125
127
126
import aws_encryption_sdk
128
-
127
+
129
128
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids = [
130
129
' arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222' ,
131
130
' arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
132
131
])
133
132
my_plaintext = ' This is some super secret data! Yup, sure is!'
134
-
133
+
135
134
my_ciphertext, encryptor_header = aws_encryption_sdk.encrypt(
136
135
source = my_plaintext,
137
136
key_provider = kms_key_provider
138
137
)
139
-
138
+
140
139
decrypted_plaintext, decryptor_header = aws_encryption_sdk.decrypt(
141
140
source = my_ciphertext,
142
141
key_provider = kms_key_provider
143
142
)
144
-
143
+
145
144
assert my_plaintext == decrypted_plaintext
146
145
assert encryptor_header.encryption_context == decryptor_header.encryption_context
147
146
@@ -150,13 +149,13 @@ You can provide an `encryption context`_: a form of additional authenticating in
150
149
.. code :: python
151
150
152
151
import aws_encryption_sdk
153
-
152
+
154
153
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids = [
155
154
' arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222' ,
156
155
' arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
157
156
])
158
157
my_plaintext = ' This is some super secret data! Yup, sure is!'
159
-
158
+
160
159
my_ciphertext, encryptor_header = aws_encryption_sdk.encrypt(
161
160
source = my_plaintext,
162
161
key_provider = kms_key_provider,
@@ -165,12 +164,12 @@ You can provide an `encryption context`_: a form of additional authenticating in
165
164
' but adds' : ' some authentication'
166
165
}
167
166
)
168
-
167
+
169
168
decrypted_plaintext, decryptor_header = aws_encryption_sdk.decrypt(
170
169
source = my_ciphertext,
171
170
key_provider = kms_key_provider
172
171
)
173
-
172
+
174
173
assert my_plaintext == decrypted_plaintext
175
174
assert encryptor_header.encryption_context == decryptor_header.encryption_context
176
175
@@ -186,15 +185,14 @@ offering context manager and iteration support.
186
185
187
186
import aws_encryption_sdk
188
187
import filecmp
189
-
188
+
190
189
kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids = [
191
190
' arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222' ,
192
191
' arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
193
192
])
194
193
plaintext_filename = ' my-secret-data.dat'
195
194
ciphertext_filename = ' my-encrypted-data.ct'
196
-
197
-
195
+
198
196
with open (plaintext_filename, ' rb' ) as pt_file, open (ciphertext_filename, ' wb' ) as ct_file:
199
197
with aws_encryption_sdk.stream(
200
198
mode = ' e' ,
@@ -203,9 +201,9 @@ offering context manager and iteration support.
203
201
) as encryptor:
204
202
for chunk in encryptor:
205
203
ct_file.write(chunk)
206
-
204
+
207
205
new_plaintext_filename = ' my-decrypted-data.dat'
208
-
206
+
209
207
with open (ciphertext_filename, ' rb' ) as ct_file, open (new_plaintext_filename, ' wb' ) as pt_file:
210
208
with aws_encryption_sdk.stream(
211
209
mode = ' d' ,
@@ -214,7 +212,7 @@ offering context manager and iteration support.
214
212
) as decryptor:
215
213
for chunk in decryptor:
216
214
pt_file.write(chunk)
217
-
215
+
218
216
assert filecmp.cmp(plaintext_filename, new_plaintext_filename)
219
217
assert encryptor.header.encryption_context == decryptor.header.encryption_context
220
218
0 commit comments