Skip to content

Commit b165607

Browse files
Merge pull request awsdocs#43 from awsdocs/kms_snippets
adding code snippet references to kms article
2 parents a229c4a + 1bd4cc8 commit b165607

File tree

2 files changed

+30
-38
lines changed

2 files changed

+30
-38
lines changed

doc_source/examples-crypto-kms.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ Import the following classes for these examples.
4141

4242
**Imports**
4343

44-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
45-
:lines: 16-31
44+
.. literalinclude:: s3.java1.s3_encrypt.import.txt
4645
:language: java
4746

4847
.. _encryption-only-kms:
@@ -57,8 +56,7 @@ managed key for encryption, pass the |KMS| key ID or alias to the
5756

5857
**Code**
5958

60-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
61-
:lines: 237-243
59+
.. literalinclude:: s3.java1.s3_encrypt.kms_encryption_only_build.txt
6260
:dedent: 8
6361
:language: java
6462

@@ -67,8 +65,7 @@ Call the :methodname:`putObject` method on the |S3| encryption client to upload
6765

6866
**Code**
6967

70-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
71-
:lines: 247
68+
.. literalinclude:: s3.java1.s3_encrypt.kms_encryption_only_put_object.txt
7269
:dedent: 8
7370
:language: java
7471

@@ -77,12 +74,11 @@ You can retrieve the object using the same client. This example calls the
7774

7875
**Code**
7976

80-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
81-
:lines: 249
77+
.. literalinclude:: s3.java1.s3_encrypt.kms_encryption_only_retrieve.txt
8278
:dedent: 8
8379
:language: java
8480

85-
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java#L236-L250>` on GitHub.
81+
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java>` on GitHub.
8682

8783
.. _authenticated-encryption-kms:
8884

@@ -106,23 +102,21 @@ To enable this mode, specify the :classname:`AuthenticatedEncryption` value in t
106102

107103
**Code**
108104

109-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
110-
:lines: 257-263
105+
.. literalinclude:: s3.java1.s3_encrypt.kms_authenticated_encryption_builder.txt
111106
:dedent: 8
112107
:language: java
113-
108+
114109
The :classname:`AuthenticatedEncryption` mode can retrieve unencrypted objects and
115110
objects encrypted with :classname:`EncryptionOnly` mode. The following example shows the
116111
|S3| encryption client retrieving an unencrypted object.
117112

118113
**Code**
119114

120-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
121-
:lines: 257-270
115+
.. literalinclude:: s3.java1.s3_encrypt.kms_authenticated_encryption_put_object.txt
122116
:dedent: 8
123117
:language: java
124118

125-
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java#L256-L271>` on GitHub.
119+
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java>` on GitHub.
126120

127121
.. _strict-authenticated-encryption-kms:
128122

@@ -138,8 +132,15 @@ To enable this mode, specify the :classname:`StrictAuthenticatedEncryption` valu
138132

139133
**Code**
140134

141-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
142-
:lines: 278-284
135+
.. literalinclude:: s3.java1.s3_encrypt.kms_authenticated_encryption_strict_builder.txt
136+
:dedent: 8
137+
:language: java
138+
139+
Call the :methodname:`putObject` method on the |S3| encryption client to upload objects.
140+
141+
**Code**
142+
143+
.. literalinclude:: s3.java1.s3_encrypt.kms_authenticated_encryption_strict_put_object.txt
143144
:dedent: 8
144145
:language: java
145146

@@ -149,9 +150,8 @@ authenticated mode.
149150

150151
**Code**
151152

152-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
153-
:lines: 278-295
153+
.. literalinclude:: s3.java1.s3_encrypt.kms_authenticated_encryption_strict_exception.txt
154154
:dedent: 8
155155
:language: java
156156

157-
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java#L278-L296>` on GitHub.
157+
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java>` on GitHub.

doc_source/examples-crypto-masterkey.rst

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ Import the following classes for these examples.
4040

4141
**Imports**
4242

43-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
44-
:lines: 16-24,26-31
43+
.. literalinclude:: s3.java1.s3_encrypt.import.txt
4544
:language: java
4645

4746
.. _encryption-only:
@@ -67,17 +66,15 @@ To use an asymmetric key or a key pair, simply pass the key pair to the same
6766

6867
**Code**
6968

70-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
71-
:lines: 217-223
69+
.. literalinclude:: s3.java1.s3_encrypt.encryption_only_asymetric_key_build.txt
7270
:dedent: 8
7371
:language: java
7472

7573
Call the :methodname:`putObject` method on the |S3| encryption client to upload objects.
7674

7775
**Code**
7876

79-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
80-
:lines: 227
77+
.. literalinclude:: s3.java1.s3_encrypt.encryption_only_asymetric_key_put_object.txt
8178
:dedent: 8
8279
:language: java
8380

@@ -86,12 +83,11 @@ You can retrieve the object using the same client. This example calls the
8683

8784
**Code**
8885

89-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
90-
:lines: 229
86+
.. literalinclude:: s3.java1.s3_encrypt.encryption_only_asymetric_key_retrieve.txt
9187
:dedent: 8
9288
:language: java
9389

94-
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java#L216-L230>` on GitHub.
90+
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java>` on GitHub.
9591

9692
.. _authenticated-encryption:
9793

@@ -114,8 +110,7 @@ To enable this mode, specify the :classname:`AuthenticatedEncryption` value in t
114110

115111
**Code**
116112

117-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
118-
:lines: 67-72
113+
.. literalinclude:: s3.java1.s3_encrypt.strict_authenticated_encryption_build.txt
119114
:dedent: 8
120115
:language: java
121116

@@ -125,8 +120,7 @@ objects encrypted with :classname:`EncryptionOnly` mode. The following example s
125120

126121
**Code**
127122

128-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
129-
:lines: 66-79
123+
.. literalinclude:: s3.java1.s3_encrypt.strict_authenticated_encryption.txt
130124
:dedent: 8
131125
:language: java
132126

@@ -146,8 +140,7 @@ To enable this mode, specify the :classname:`StrictAuthenticatedEncryption` valu
146140

147141
**Code**
148142

149-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
150-
:lines: 132-137
143+
.. literalinclude:: s3.java1.s3_encrypt.strict_authenticated_encryption_build.txt
151144
:dedent: 8
152145
:language: java
153146

@@ -157,9 +150,8 @@ authenticated mode.
157150

158151
**Code**
159152

160-
.. literalinclude:: example_code/s3/src/main/java/aws/example/s3/S3Encrypt.java
161-
:lines: 131-149
153+
.. literalinclude:: s3.java1.s3_encrypt.strict_authenticated_encryption.txt
162154
:dedent: 8
163155
:language: java
164156

165-
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java#L131-L150>` on GitHub.
157+
See the :sdk-examples-java-s3:`complete example <S3Encrypt.java>` on GitHub.

0 commit comments

Comments
 (0)