6
6
import io .opentdf .platform .sdk .AssertionConfig ;
7
7
import io .opentdf .platform .sdk .AutoConfigureException ;
8
8
import io .opentdf .platform .sdk .Config ;
9
+ import io .opentdf .platform .sdk .KeyType ;
9
10
import io .opentdf .platform .sdk .Config .AssertionVerificationKeys ;
10
11
import io .opentdf .platform .sdk .NanoTDF ;
11
12
import io .opentdf .platform .sdk .SDK ;
@@ -145,6 +146,8 @@ void encrypt(
145
146
@ Option (names = { "-a" , "--attr" }, defaultValue = Option .NULL_VALUE ) Optional <String > attributes ,
146
147
@ Option (names = { "-c" ,
147
148
"--autoconfigure" }, defaultValue = Option .NULL_VALUE ) Optional <Boolean > autoconfigure ,
149
+ @ Option (names = {
150
+ "--encap-key-type" }, defaultValue = Option .NULL_VALUE , description = "Preferred key access key wrap algorithm, one of ${COMPLETION-CANDIDATES}" ) Optional <KeyType > encapKeyType ,
148
151
@ Option (names = { "--mime-type" }, defaultValue = Option .NULL_VALUE ) Optional <String > mimeType ,
149
152
@ Option (names = { "--with-assertions" }, defaultValue = Option .NULL_VALUE ) Optional <String > assertion )
150
153
@@ -161,6 +164,7 @@ void encrypt(
161
164
configs .add (Config .withKasInformation (kasInfos ));
162
165
metadata .map (Config ::withMetaData ).ifPresent (configs ::add );
163
166
autoconfigure .map (Config ::withAutoconfigure ).ifPresent (configs ::add );
167
+ encapKeyType .map (Config ::WithWrappingKeyAlg ).ifPresent (configs ::add );
164
168
mimeType .map (Config ::withMimeType ).ifPresent (configs ::add );
165
169
166
170
if (assertion .isPresent ()) {
@@ -226,6 +230,7 @@ private SDK buildSDK() {
226
230
227
231
@ CommandLine .Command (name = "decrypt" )
228
232
void decrypt (@ Option (names = { "-f" , "--file" }, required = true ) Path tdfPath ,
233
+ @ Option (names = { "--rewrap-key-type" }, defaultValue = Option .NULL_VALUE , description = "Preferred rewrap algorithm, one of ${COMPLETION-CANDIDATES}" ) Optional <KeyType > rewrapKeyType ,
229
234
@ Option (names = { "--with-assertion-verification-disabled" }, defaultValue = "false" ) boolean disableAssertionVerification ,
230
235
@ Option (names = { "--with-assertion-verification-keys" }, defaultValue = Option .NULL_VALUE ) Optional <String > assertionVerification )
231
236
throws IOException , TDF .FailedToCreateGMAC , JOSEException , ParseException , NoSuchAlgorithmException , DecoderException {
@@ -266,6 +271,7 @@ void decrypt(@Option(names = { "-f", "--file" }, required = true) Path tdfPath,
266
271
if (disableAssertionVerification ) {
267
272
opts .add (Config .withDisableAssertionVerification (true ));
268
273
}
274
+ rewrapKeyType .map (Config ::WithSessionKeyType ).ifPresent (opts ::add );
269
275
270
276
var readerConfig = Config .newTDFReaderConfig (opts .toArray (new Consumer [0 ]));
271
277
var reader = new TDF ().loadTDF (in , sdk .getServices ().kas (), readerConfig );
0 commit comments