|
1 | 1 | # AWS Encryption SDK for Javascript Node.js examples
|
2 | 2 |
|
3 |
| -This repository holds examples for encrypt and decrypt in Node.js. |
4 |
| -These examples are intended to work so you can experiment with functional code. |
| 3 | +This repository includes examples for encrypting and decrypting in Node.js. These are not for production use. |
5 | 4 |
|
6 |
| -# NOTE |
7 |
| -The CMK's in these examples *are only* for example. They *are public*. |
8 |
| -Replace these CMK's with your own. |
| 5 | +To run this example, you must have an AWS account with at least one AWS Key Management Service (AWS KMS) customer managed CMK. |
| 6 | +To encrypt, the CMK must have kms:GenerateDataKey permission. |
| 7 | +To decrypt, the CMK must have kms:Decrypt permission. |
| 8 | +The CMKs in these examples are only for *example*. *Replace these CMKs with your own*. |
9 | 9 |
|
10 | 10 | ## KMS Simple
|
11 | 11 |
|
12 |
| -This is the simples example. |
13 |
| -It encrypts and decrypts a simple string with KMS. |
| 12 | +This is an example of using the AWS Encryption SDK to encrypt and decrypt a simple string. |
| 13 | +For a more detailed explanation, see kms_simple.ts. |
14 | 14 |
|
15 | 15 | ## KMS Stream
|
16 | 16 |
|
17 |
| -An example of encrypting a file stream with KMS. |
| 17 | +This is an example of using a KMS keyring to encrypt and decrypt a file stream. |
| 18 | +For a more detailed explanation, see kms_stream.ts. |
18 | 19 |
|
19 | 20 | ## KMS Regional Discovery
|
20 | 21 |
|
21 |
| -KMS Keyrings can be put in `discovery` mode. |
22 |
| -This means that it will attempt to connect to any region. |
23 |
| -This is not always what you want. |
24 |
| -Perhapses for performance you want to limit attempts to a set of "close" regions. |
25 |
| -Perhapses for policy reason you want to exclude some regions. |
| 22 | +This is an example of using a KMS Regional Discovery Keyring that limits the AWS Encryption SDK to CMKs in a particular AWS Region(s). |
| 23 | +This is different from a KMS Discovery Keyring that doesn't specify any CMKs and will therefore use CMKs from any region available. |
| 24 | +For a more detailed explanation, see kms_regional_discovery.ts. |
26 | 25 |
|
27 | 26 | ## RSA Simple
|
28 | 27 |
|
29 |
| -Sometimes you may want to use an RSA key to exchange secrets. |
30 |
| -This has some advantages, but comes with a heaved key management cost. |
31 |
| -If you can use KMS, the context guaranties are generally worth it. |
32 |
| -However, I still want to provide an example incase this fits your use case. |
| 28 | +This is an example of using a RSA key pair to encrypt and decrypt a simple string. |
| 29 | +This has some advantages for certain use cases, but we recommend that you use a keyring that protects your wrapping keys and performs cryptographic operations within a secure boundary. A KMS keyring uses AWS Key Management Service (AWS KMS) customer master keys (CMKs) that never leave AWS KMS unencrypted. |
| 30 | +For a more detailed explanation, see rsa_simple.ts. |
| 31 | + |
| 32 | +## How to Use |
| 33 | + |
| 34 | +To see these examples in action, run `npm test`. |
| 35 | + |
| 36 | +## License |
| 37 | + |
| 38 | +This SDK is distributed under the |
| 39 | +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), |
| 40 | +see LICENSE.txt and NOTICE.txt for more information. |
0 commit comments