Skip to content

Commit 2007228

Browse files
ambrose40SanderKondratjevNortal
authored andcommitted
Optimizations, cleanups and fixes for libcdoc library: open-eid/libcdoc#73. (#271)
MOPPAND-1648 Optimizations, cleanups and fixes for libcdoc library: open-eid/libcdoc#73.
1 parent e3021d6 commit 2007228

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

crypto-lib/libs/libcdoc.jar

0 Bytes
Binary file not shown.
90.8 KB
Binary file not shown.
-47.1 KB
Binary file not shown.
118 KB
Binary file not shown.
90.8 KB
Binary file not shown.
-47.1 KB
Binary file not shown.
118 KB
Binary file not shown.

crypto-lib/src/main/kotlin/ee/ria/DigiDoc/cryptolib/CryptoContainer.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -348,30 +348,30 @@ class CryptoContainer
348348
}
349349

350350
val cdocWriter = CDocWriter.createWriter(version, file?.path, conf, null, network)
351-
withContext(IO) {
352-
if (version == 2 && cdoc2Settings.getUseOnlineEncryption()) {
353-
val serverId = cdoc2Settings.getCDOC2UUID()
354-
recipients.forEach { addressee ->
355-
val recipient = Recipient.makeEIDServer(addressee?.data, serverId)
356-
if (cdocWriter.addRecipient(recipient) != 0L) {
357-
throw CryptoException("Failed to add recipient")
358-
}
359-
}
360-
} else {
361-
recipients.forEach { addressee ->
362-
val recipient = Recipient.makeEID(addressee?.data)
363-
if (cdocWriter.addRecipient(recipient) != 0L) {
364-
throw CryptoException("Failed to add recipient")
365-
}
366-
}
367-
}
368-
}
369-
370351
try {
371352
if (cdocWriter.beginEncryption() != 0L) {
372353
throw CryptoException("Failed to begin encryption")
373354
}
374355

356+
withContext(IO) {
357+
if (version == 2 && cdoc2Settings.getUseOnlineEncryption()) {
358+
val serverId = cdoc2Settings.getCDOC2UUID()
359+
recipients.forEach { addressee ->
360+
val recipient = Recipient.makeEIDServer(addressee?.data, serverId)
361+
if (cdocWriter.addRecipient(recipient) != 0L) {
362+
throw CryptoException("Failed to add recipient")
363+
}
364+
}
365+
} else {
366+
recipients.forEach { addressee ->
367+
val recipient = Recipient.makeEID(addressee?.data)
368+
if (cdocWriter.addRecipient(recipient) != 0L) {
369+
throw CryptoException("Failed to add recipient")
370+
}
371+
}
372+
}
373+
}
374+
375375
withContext(IO) {
376376
dataFiles.forEach { dataFile ->
377377
val ifs: InputStream = FileInputStream(dataFile)

0 commit comments

Comments
 (0)