Skip to content

Commit b61b581

Browse files
author
Olesja Aarma
committed
RM-4763: update lib.README
1 parent c2229f5 commit b61b581

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

cdoc2-lib/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ When certificate has expired there is needed to replace it with new certificate
230230

231231
CDocBuilder builder = new CDocBuilder()
232232
.withPayloadFiles(Arrays.asList(payloadFiles))
233-
.withRecipients(List.of(km))
234-
.buildToFile(cdoc2FileToCreate);
233+
.withRecipients(List.of(km));
234+
235+
builder.buildToFile(cdoc2FileToCreate);
235236
```
236237

237238
### To decrypt with password:
@@ -257,10 +258,12 @@ When certificate has expired there is needed to replace it with new certificate
257258

258259
List<EncryptionKeyMaterial> recipients =
259260
EncryptionKeyMaterial.collectionBuilder().fromEId(new String[]{identificationCode});
261+
260262
CDocBuilder builder = new CDocBuilder()
261263
.withPayloadFiles(Arrays.asList(payloadFiles))
262-
.withRecipients(recipients)
263-
.buildToFile(cdoc2FileToCreate);
264+
.withRecipients(recipients);
265+
266+
builder.buildToFile(cdoc2FileToCreate);
264267
```
265268

266269
**Note**: this works only for end user id-cards. It doesn't work for test id-cards as test-id card
@@ -332,11 +335,13 @@ directory and `.withServerProperties` method:
332335

333336
List<EncryptionKeyMaterial> recipients =
334337
EncryptionKeyMaterial.collectionBuilder().fromEId(new String[]{identificationCode});
338+
335339
CDocBuilder builder = new CDocBuilder()
336340
.withServerProperties(p)
337341
.withPayloadFiles(Arrays.asList(payloadFiles))
338-
.withRecipients(recipients)
339-
.buildToFile(cdoc2FileToCreate);
342+
.withRecipients(recipients);
343+
344+
builder.buildToFile(cdoc2FileToCreate);
340345
```
341346
**Note**: `cdoc2-cli/config` contains usually several properties files. For id-card usage, use one with
342347
the shortest name (without `_pkcs12` or `_p12` in name).
@@ -376,13 +381,12 @@ key parts
376381
.forAuthMeans(new String[]{identificationCode}) // will create authentication based recipient, that can be decrypted with SID/MID
377382
.build();
378383

379-
380-
CDocBuilder builder = new CDocBuilder()
384+
CDocBuilder builder = new CDocBuilder()
381385
.withPayloadFiles(files)
382386
.withRecipients(encKeyMaterial)
383387
.withServices(services);
384388

385-
builder.buildToFile(cdoc2FileToCreate);
389+
builder.buildToFile(cdoc2FileToCreate);
386390
```
387391

388392
### Decrypting with key material from the server

cdoc2-lib/src/test/java/ee/cyber/cdoc2/container/EnvelopeTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ void testCdocBuilder(@TempDir Path tempDir) throws Exception {
968968

969969
builder.buildToFile(cdocFile);
970970

971-
972971
List<Recipient> recipients = Envelope.parseHeader(Files.newInputStream(cdocFile.toPath()));
973972

974973
assertTrue(recipients.size() == 2);

0 commit comments

Comments
 (0)