|
| 1 | +# AWS Encryption SDK for .NET Examples |
| 2 | + |
| 3 | +This section features examples that show you |
| 4 | +how to use the AWS Encryption SDK. |
| 5 | +We demonstrate how to use the encryption and decryption APIs |
| 6 | +and how to set up some common configuration patterns. |
| 7 | + |
| 8 | +## APIs |
| 9 | + |
| 10 | +The AWS Encryption SDK provides two high-level APIs: |
| 11 | +one-step APIs that process the entire operation in memory |
| 12 | +and streaming APIs. |
| 13 | + |
| 14 | +You can find examples that demonstrate these APIs |
| 15 | +in the [`examples/dotnet/`](./) directory. |
| 16 | + |
| 17 | +* [How to encrypt and decrypt](./) *TODO* |
| 18 | +* [How to change the algorithm suite](./) *TODO* |
| 19 | +* [How to encrypt and decrypt data streams in memory](./) *TODO* |
| 20 | +* [How to encrypt and decrypt data streamed between files](./) *TODO* |
| 21 | + |
| 22 | +## Configuration |
| 23 | + |
| 24 | +To use the encryption and decryption APIs, |
| 25 | +you need to describe how you want the library to protect your data keys. |
| 26 | +You can do this by configuring |
| 27 | +[keyrings](#keyrings) or [cryptographic materials managers](#cryptographic-materials-managers). |
| 28 | +These examples will show you how to use the configuration tools that we include for you |
| 29 | +and how to create some of your own. |
| 30 | +We start with AWS KMS examples, then show how to use other wrapping keys. |
| 31 | + |
| 32 | +* Using AWS Key Management Service (AWS KMS) Keyring |
| 33 | + * [How to use one AWS KMS CMK](./) *TODO* |
| 34 | + * [How to use multiple AWS KMS CMKs in different regions](./) *TODO* |
| 35 | + * [How to decrypt when you don't know the CMK](./) *TODO* |
| 36 | + * [How to decrypt within a region](./) *TODO* |
| 37 | + * [How to decrypt with a preferred region but failover to others](./) *TODO* |
| 38 | + * [How to reproduce the behavior of an AWS KMS master key provider](./) *TODO* |
| 39 | +* Using raw wrapping keys |
| 40 | + * [How to use a raw AES wrapping key](./keyrings/RawRSAKeyring/RawAESKeyringExample.cs) |
| 41 | + * [How to use a raw RSA wrapping key](./) *TODO* |
| 42 | + * [How to use a raw RSA wrapping key when the key is PEM or DER encoded](./) *TODO* |
| 43 | + * [How to encrypt with a raw RSA public key wrapping key without access to the private key](./) *TODO* |
| 44 | +* Combining wrapping keys |
| 45 | + * [How to combine AWS KMS with an offline escrow key](./) *TODO* |
| 46 | +* How to reuse data keys across multiple messages |
| 47 | + * [with the caching cryptographic materials manager](./) *TODO* |
| 48 | +* How to restrict algorithm suites |
| 49 | + * [with a custom cryptographic materials manager](./) *TODO* |
| 50 | +* How to require encryption context fields |
| 51 | + * [with a custom cryptographic materials manager](./) *TODO* |
| 52 | + |
| 53 | +### Keyrings |
| 54 | + |
| 55 | +Keyrings are the most common way for you to configure the AWS Encryption SDK. |
| 56 | +They determine how the AWS Encryption SDK protects your data. |
| 57 | +You can find these examples in [`examples/dotnet/keyrings`](./keyring). |
| 58 | + |
| 59 | +### Cryptographic Materials Managers |
| 60 | + |
| 61 | +Keyrings define how your data keys are protected, |
| 62 | +but there is more going on here than just protecting data keys. |
| 63 | + |
| 64 | +Cryptographic materials managers give you higher-level controls |
| 65 | +over how the AWS Encryption SDK protects your data. |
| 66 | +This can include things like |
| 67 | +enforcing the use of certain algorithm suites or encryption context settings, |
| 68 | +reusing data keys across messages, |
| 69 | +or changing how you interact with keyrings. |
| 70 | +You can find these examples in |
| 71 | +[`examples/dotnet/CryptoMaterialsManager`](./CryptoMaterialsManager). |
| 72 | + |
| 73 | +# Writing Examples |
| 74 | + |
| 75 | +If you want to contribute a new example, that's awesome! |
| 76 | +To make sure that your example is tested in our CI, |
| 77 | +please make sure that it meets the following requirements: |
| 78 | + |
| 79 | +1. The example MUST be a distinct module in the [`examples/dotnet/`](./) directory. |
| 80 | +1. The example MAY be nested arbitrarily deeply. |
| 81 | +1. Each example file MUST contain exactly one example. |
| 82 | +1. Each example filename MUST be descriptive. |
| 83 | +1. Each example file MUST contain a public class matching the filename. |
| 84 | +1. Each example file MUST contain a method called `run` that runs the example. |
| 85 | +1. Each example MUST be exercised by a `[Fact]` test method within its class. |
0 commit comments