Skip to content

Commit 7a34045

Browse files
authored
Removed "=" padding characters in JWE compact examples, clean-up
1 parent 1e816e4 commit 7a34045

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

README.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ See also:
171171

172172
#### Performing JWE Encryption <a name="performing-jwe-encryption"></a>
173173

174-
Call `JweEncryption.encryptPayload` with a JSON request payload and an `JweConfig` instance.
174+
Call `JweEncryption.encryptPayload` with a JSON request payload and a `JweConfig` instance.
175175

176176
Example using the configuration [above](#configuring-the-jwe-encryption):
177177
```java
@@ -195,7 +195,7 @@ Output:
195195
"path": {
196196
"to": {
197197
"encryptedFoo": {
198-
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM(...)==.Y+oPYKZEMTKyYcSIVEgtQw=="
198+
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
199199
}
200200
}
201201
}
@@ -204,15 +204,15 @@ Output:
204204

205205
#### Performing JWE Decryption <a name="performing-jwe-decryption"></a>
206206

207-
Call `JweEncryption.decryptPayload` with a JSON response payload and an `JweConfig` instance.
207+
Call `JweEncryption.decryptPayload` with a JSON response payload and a `JweConfig` instance.
208208

209209
Example using the configuration [above](#configuring-the-jwe-encryption):
210210
```java
211211
String encryptedPayload = "{" +
212212
" \"path\": {" +
213213
" \"to\": {" +
214214
" \"encryptedFoo\": {" +
215-
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM(...)==.Y+oPYKZEMTKyYcSIVEgtQw==\"" +
215+
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
216216
" }" +
217217
" }" +
218218
" }" +
@@ -243,7 +243,7 @@ Entire payloads can be encrypted using the "$" operator as encryption path:
243243
JweConfig config = JweConfigBuilder.aJweEncryptionConfig()
244244
.withEncryptionCertificate(encryptionCertificate)
245245
.withEncryptionPath("$", "$")
246-
// ...
246+
//
247247
.build();
248248
```
249249

@@ -260,7 +260,7 @@ System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(new Jso
260260
Output:
261261
```json
262262
{
263-
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM(...)==.Y+oPYKZEMTKyYcSIVEgtQw=="
263+
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
264264
}
265265
```
266266

@@ -272,14 +272,14 @@ Entire payloads can be decrypted using the "$" operator as decryption path:
272272
JweConfig config = JweConfigBuilder.aJweEncryptionConfig()
273273
.withDecryptionKey(decryptionKey)
274274
.withDecryptionPath("$", "$")
275-
// ...
275+
//
276276
.build();
277277
```
278278

279279
Example:
280280
```java
281281
String encryptedPayload = "{" +
282-
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM(...)==.Y+oPYKZEMTKyYcSIVEgtQw==\"" +
282+
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
283283
"}";
284284
String payload = JweEncryption.decryptPayload(encryptedPayload, config);
285285
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(new JsonParser().parse(payload)));
@@ -340,7 +340,7 @@ See also:
340340

341341
#### Performing Mastercard Encryption <a name="performing-mastercard-encryption"></a>
342342

343-
Call `FieldLevelEncryption.encryptPayload` with a JSON request payload and an `FieldLevelEncryptionConfig` instance.
343+
Call `FieldLevelEncryption.encryptPayload` with a JSON request payload and a `FieldLevelEncryptionConfig` instance.
344344

345345
Example using the configuration [above](#configuring-the-field-level-encryption):
346346
```java
@@ -365,8 +365,8 @@ Output:
365365
"to": {
366366
"encryptedFoo": {
367367
"iv": "7f1105fb0c684864a189fb3709ce3d28",
368-
"encryptedKey": "67f467d1b653d98411a0c6d3c(...)ffd4c09dd42f713a51bff2b48f937c8",
369-
"encryptedValue": "b73aabd267517fc09ed72455c2(...)dffb5fa04bf6e6ce9ade1ff514ed6141"
368+
"encryptedKey": "67f467d1b653d98411a0c6d3cffd4c09dd42f713a51bff2b48f937c8",
369+
"encryptedValue": "b73aabd267517fc09ed72455c2dffb5fa04bf6e6ce9ade1ff514ed6141"
370370
}
371371
}
372372
}
@@ -375,7 +375,7 @@ Output:
375375

376376
#### Performing Mastercard Decryption <a name="performing-mastercard-decryption"></a>
377377

378-
Call `FieldLevelEncryption.decryptPayload` with a JSON response payload and an `FieldLevelEncryptionConfig` instance.
378+
Call `FieldLevelEncryption.decryptPayload` with a JSON response payload and a `FieldLevelEncryptionConfig` instance.
379379

380380
Example using the configuration [above](#configuring-the-field-level-encryption):
381381
```java
@@ -384,8 +384,8 @@ String encryptedPayload = "{" +
384384
" \"to\": {" +
385385
" \"encryptedFoo\": {" +
386386
" \"iv\": \"e5d313c056c411170bf07ac82ede78c9\"," +
387-
" \"encryptedKey\": \"e3a56746c0f9109d18b3a2652b76(...)f16d8afeff36b2479652f5c24ae7bd\"," +
388-
" \"encryptedValue\": \"809a09d78257af5379df0c454dcdf(...)353ed59fe72fd4a7735c69da4080e74f\"" +
387+
" \"encryptedKey\": \"e3a56746c0f9109d18b3a2652b76f16d8afeff36b2479652f5c24ae7bd\"," +
388+
" \"encryptedValue\": \"809a09d78257af5379df0c454dcdf353ed59fe72fd4a7735c69da4080e74f\"" +
389389
" }" +
390390
" }" +
391391
" }" +
@@ -416,7 +416,7 @@ Entire payloads can be encrypted using the "$" operator as encryption path:
416416
FieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder.aFieldLevelEncryptionConfig()
417417
.withEncryptionCertificate(encryptionCertificate)
418418
.withEncryptionPath("$", "$")
419-
// ...
419+
//
420420
.build();
421421
```
422422

@@ -434,8 +434,8 @@ Output:
434434
```json
435435
{
436436
"iv": "1b9396c98ab2bfd195de661d70905a45",
437-
"encryptedKey": "7d5112fa08e554e3dbc455d0628(...)52e826dd10311cf0d63bbfb231a1a63ecc13",
438-
"encryptedValue": "e5e9340f4d2618d27f8955828c86(...)379b13901a3b1e2efed616b6750a90fd379515"
437+
"encryptedKey": "7d5112fa08e554e3dbc455d062852e826dd10311cf0d63bbfb231a1a63ecc13",
438+
"encryptedValue": "e5e9340f4d2618d27f8955828c86379b13901a3b1e2efed616b6750a90fd379515"
439439
}
440440
```
441441

@@ -447,16 +447,16 @@ Entire payloads can be decrypted using the "$" operator as decryption path:
447447
FieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder.aFieldLevelEncryptionConfig()
448448
.withDecryptionKey(decryptionKey)
449449
.withDecryptionPath("$", "$")
450-
// ...
450+
//
451451
.build();
452452
```
453453

454454
Example:
455455
```java
456456
String encryptedPayload = "{" +
457457
" \"iv\": \"1b9396c98ab2bfd195de661d70905a45\"," +
458-
" \"encryptedKey\": \"7d5112fa08e554e3dbc455d0628(...)52e826dd10311cf0d63bbfb231a1a63ecc13\"," +
459-
" \"encryptedValue\": \"e5e9340f4d2618d27f8955828c86(...)379b13901a3b1e2efed616b6750a90fd379515\"" +
458+
" \"encryptedKey\": \"7d5112fa08e554e3dbc455d062852e826dd10311cf0d63bbfb231a1a63ecc13\"," +
459+
" \"encryptedValue\": \"e5e9340f4d2618d27f8955828c86379b13901a3b1e2efed616b6750a90fd379515\"" +
460460
"}";
461461
String payload = FieldLevelEncryption.decryptPayload(encryptedPayload, config);
462462
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(new JsonParser().parse(payload)));
@@ -478,7 +478,7 @@ Here is how to configure the library for using HTTP headers instead.
478478

479479
##### Configuration for Using HTTP Headers <a name="configuration-for-using-http-headers"></a>
480480

481-
Call `with{Param}HeaderName` instead of `with{Param}FieldName` when building an `FieldLevelEncryptionConfig` instance. Example:
481+
Call `with{Param}HeaderName` instead of `with{Param}FieldName` when building a `FieldLevelEncryptionConfig` instance. Example:
482482
```java
483483
FieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder.aFieldLevelEncryptionConfig()
484484
.withEncryptionCertificate(encryptionCertificate)
@@ -489,7 +489,7 @@ FieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder.aFieldLeve
489489
.withEncryptedValueFieldName("data")
490490
.withIvHeaderName("x-iv")
491491
.withEncryptedKeyHeaderName("x-encrypted-key")
492-
// ...
492+
//
493493
.withFieldValueEncoding(FieldValueEncoding.HEX)
494494
.build();
495495
```
@@ -513,7 +513,7 @@ FieldLevelEncryptionParams params = FieldLevelEncryptionParams.generate(config);
513513
```java
514514
request.setHeader(config.getIvHeaderName(), params.getIvValue());
515515
request.setHeader(config.getEncryptedKeyHeaderName(), params.getEncryptedKeyValue());
516-
// ...
516+
//
517517
```
518518

519519
3. Call `encryptPayload` with params:
@@ -535,7 +535,7 @@ System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(new Jso
535535
Output:
536536
```json
537537
{
538-
"data": "53b5f07ee46403af2e92abab900853(...)d560a0a08a1ed142099e3f4c84fe5e5"
538+
"data": "53b5f07ee46403af2e92abab900853d560a0a08a1ed142099e3f4c84fe5e5"
539539
}
540540
```
541541

@@ -548,13 +548,13 @@ Decryption can be performed using the following steps:
548548
```java
549549
String ivValue = response.getHeader(config.getIvHeaderName());
550550
String encryptedKeyValue = response.getHeader(config.getEncryptedKeyHeaderName());
551-
// ...
551+
//
552552
```
553553

554554
2. Create a `FieldLevelEncryptionParams` instance:
555555

556556
```java
557-
FieldLevelEncryptionParams params = new FieldLevelEncryptionParams(ivValue, encryptedKeyValue, ..., config);
557+
FieldLevelEncryptionParams params = new FieldLevelEncryptionParams(ivValue, encryptedKeyValue, , config);
558558
```
559559

560560
3. Call `decryptPayload` with params:
@@ -566,7 +566,7 @@ Example using the configuration [above](#configuration-for-using-http-headers):
566566

567567
```java
568568
String encryptedPayload = "{" +
569-
" \"data\": \"53b5f07ee46403af2e92abab900853(...)d560a0a08a1ed142099e3f4c84fe5e5\"" +
569+
" \"data\": \"53b5f07ee46403af2e92abab900853d560a0a08a1ed142099e3f4c84fe5e5\"" +
570570
"}";
571571
String payload = FieldLevelEncryption.decryptPayload(encryptedPayload, config, params);
572572
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(new JsonParser().parse(payload)));
@@ -607,7 +607,7 @@ See also:
607607
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
608608
<generatorName>java</generatorName>
609609
<library>okhttp-gson</library>
610-
<!-- ... -->
610+
<!-- -->
611611
</configuration>
612612
```
613613

@@ -619,7 +619,7 @@ List<Interceptor> interceptors = client.getHttpClient().interceptors();
619619
interceptors.add(OkHttp2EncryptionInterceptor.from(config));
620620
interceptors.add(new OkHttp2OAuth1Interceptor(consumerKey, signingKey));
621621
ServiceApi serviceApi = new ServiceApi(client);
622-
// ...
622+
//
623623
```
624624

625625
##### Usage of the `OkHttpFieldLevelEncryptionInterceptor` (OpenAPI Generator 4.x.y)
@@ -634,7 +634,7 @@ client.setHttpClient(
634634
.build()
635635
);
636636
ServiceApi serviceApi = new ServiceApi(client);
637-
// ...
637+
//
638638
```
639639

640640
#### feign <a name="feign"></a>
@@ -644,7 +644,7 @@ ServiceApi serviceApi = new ServiceApi(client);
644644
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
645645
<generatorName>java</generatorName>
646646
<library>feign</library>
647-
<!-- ... -->
647+
<!-- -->
648648
</configuration>
649649
```
650650

@@ -660,7 +660,7 @@ feignBuilder.requestInterceptors(interceptors);
660660
feignBuilder.encoder(OpenFeignEncoderExecutor.from(config, new FormEncoder(new JacksonEncoder(objectMapper))));
661661
feignBuilder.decoder(OpenFeignDecoderExecutor.from(config, new JacksonDecoder(objectMapper)));
662662
ServiceApi serviceApi = client.buildClient(ServiceApi.class);
663-
// ...
663+
//
664664
```
665665

666666
#### retrofit <a name="retrofit"></a>
@@ -670,7 +670,7 @@ ServiceApi serviceApi = client.buildClient(ServiceApi.class);
670670
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
671671
<generatorName>java</generatorName>
672672
<library>retrofit</library>
673-
<!-- ... -->
673+
<!-- -->
674674
</configuration>
675675
```
676676

@@ -683,7 +683,7 @@ List<Interceptor> interceptors = client.getOkClient().interceptors();
683683
interceptors.add(OkHttp2EncryptionInterceptor.from(config));
684684
interceptors.add(new OkHttp2OAuth1Interceptor(consumerKey, signingKey));
685685
ServiceApi serviceApi = client.createService(ServiceApi.class);
686-
// ...
686+
//
687687
```
688688

689689
#### retrofit2 <a name="retrofit2"></a>
@@ -693,7 +693,7 @@ ServiceApi serviceApi = client.createService(ServiceApi.class);
693693
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
694694
<generatorName>java</generatorName>
695695
<library>retrofit2</library>
696-
<!-- ... -->
696+
<!-- -->
697697
</configuration>
698698
```
699699

@@ -706,7 +706,7 @@ OkHttpClient.Builder okBuilder = client.getOkBuilder();
706706
okBuilder.addInterceptor(OkHttpEncryptionInterceptor.from(config));
707707
okBuilder.addInterceptor(new OkHttpOAuth1Interceptor(consumerKey, signingKey));
708708
ServiceApi serviceApi = client.createService(ServiceApi.class);
709-
// ...
709+
//
710710
```
711711

712712
#### google-api-client <a name="google-api-client"></a>
@@ -716,7 +716,7 @@ ServiceApi serviceApi = client.createService(ServiceApi.class);
716716
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
717717
<generatorName>java</generatorName>
718718
<library>google-api-client</library>
719-
<!-- ... -->
719+
<!-- -->
720720
</configuration>
721721
```
722722

@@ -733,5 +733,5 @@ HttpRequestInitializer initializer = new HttpRequestInitializer() {
733733
};
734734
ApiClient client = new ApiClient("https://sandbox.api.mastercard.com", null, initializer, null);
735735
ServiceApi serviceApi = client.serviceApi();
736-
// ...
736+
//
737737
```

0 commit comments

Comments
 (0)