diff options
author | Antoine A <> | 2024-03-09 15:18:25 +0100 |
---|---|---|
committer | Antoine A <> | 2024-03-09 15:18:25 +0100 |
commit | 30eefb68a131b44edc78d3dbf346be840f999b0a (patch) | |
tree | ee56a06eaa85b6f85edff48c609ae176856bc495 /nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt | |
parent | 16b5d74cad21d533353b0412b78302dcd37304f8 (diff) | |
download | libeufin-30eefb68a131b44edc78d3dbf346be840f999b0a.tar.gz libeufin-30eefb68a131b44edc78d3dbf346be840f999b0a.tar.bz2 libeufin-30eefb68a131b44edc78d3dbf346be840f999b0a.zip |
Eager base64 decoding for EBICS order data
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt')
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt index 8fd7e07b..fd969340 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt @@ -78,15 +78,14 @@ enum class SupportedDocument { * one actually used to encrypt the payload. * @param encryptionInfo details related to the encrypted payload. * @param chunks the several chunks that constitute the whole encrypted payload. - * @return the plain payload. Errors throw, so the caller must handle those. + * @return the plain payload. */ fun decryptAndDecompressPayload( clientEncryptionKey: RSAPrivateCrtKey, encryptionInfo: DataEncryptionInfo, - chunks: List<String> + chunks: List<ByteArray> ): InputStream = - SequenceInputStream(Collections.enumeration(chunks.map { it.toByteArray().inputStream() })) // Aggregate - .decodeBase64() + SequenceInputStream(Collections.enumeration(chunks.map { it.inputStream() })) // Aggregate .run { CryptoUtil.decryptEbicsE002( encryptionInfo.transactionKey, @@ -233,7 +232,7 @@ suspend fun ebicsDownload( checkCancellation() // Decompress encrypted chunks - val payloadBytes = try { + val payloadStream = try { decryptAndDecompressPayload( clientKeys.encryption_private_key, dataEncryptionInfo, @@ -247,7 +246,7 @@ suspend fun ebicsDownload( // Run business logic val res = runCatching { - processing(payloadBytes) + processing(payloadStream) } // First send a proper EBICS transaction receipt |