[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: implement compressed C53 responses
From: |
gnunet |
Subject: |
[libeufin] branch master updated: implement compressed C53 responses |
Date: |
Thu, 05 Mar 2020 15:43:27 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 2b0915e implement compressed C53 responses
2b0915e is described below
commit 2b0915e3b03474b4ed9315338ae8749815900207
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Mar 5 15:42:47 2020 +0100
implement compressed C53 responses
---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 4 ----
sandbox/build.gradle | 1 +
.../tech/libeufin/sandbox/EbicsProtocolBackend.kt | 23 ++++++++++++++++++++--
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 6379649..0a8d4cf 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -38,11 +38,8 @@ import io.ktor.routing.post
import io.ktor.routing.routing
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
-import javafx.util.Pair
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
import org.apache.commons.compress.archivers.zip.ZipFile
import org.apache.commons.compress.utils.SeekableInMemoryByteChannel
-import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.exceptions.ExposedSQLException
import org.jetbrains.exposed.sql.StdOutSqlLogger
import org.jetbrains.exposed.sql.addLogger
@@ -466,7 +463,6 @@ fun main() {
}
get("/ebics/subscribers/{id}/accounts") {
- // FIXME(marcello): return bank accounts associated with the
subscriber,
// this information is only avaiable *after* HTD or HKD has
been called
val id = expectId(call.parameters["id"])
val ret = EbicsAccountsInfoResponse()
diff --git a/sandbox/build.gradle b/sandbox/build.gradle
index 90f5243..e03114e 100644
--- a/sandbox/build.gradle
+++ b/sandbox/build.gradle
@@ -40,6 +40,7 @@ dependencies {
implementation 'org.apache.santuario:xmlsec:2.1.4'
implementation group: 'org.bouncycastle', name: 'bcprov-jdk16', version:
'1.45'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
+ implementation group: 'org.apache.commons', name: 'commons-compress',
version: '1.20'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.3.50'
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 670ec69..04c7f50 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -40,6 +40,7 @@ import tech.libeufin.util.EbicsOrderUtil
import tech.libeufin.util.XMLUtil
import tech.libeufin.util.*
import tech.libeufin.util.XMLUtil.Companion.signEbicsResponse
+import java.io.ByteArrayOutputStream
import java.math.BigDecimal
import java.security.interfaces.RSAPrivateCrtKey
import java.security.interfaces.RSAPublicKey
@@ -48,6 +49,11 @@ import java.util.zip.DeflaterInputStream
import java.util.zip.InflaterInputStream
import javax.sql.rowset.serial.SerialBlob
import javax.xml.datatype.DatatypeFactory
+import org.apache.commons.compress.archivers.ArchiveStreamFactory
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
+import org.apache.commons.compress.utils.IOUtils
+import java.io.BufferedInputStream
+import java.io.ByteArrayInputStream
open class EbicsRequestError(errorText: String, errorCode: String) :
@@ -273,7 +279,7 @@ private fun constructCamtResponse(type: Int, customerId:
Int, header: EbicsReque
}
}
}
- return camt
+ return camt
}
@@ -288,7 +294,20 @@ private fun handleEbicsPTK(requestContext:
RequestContext): ByteArray {
private fun handleEbicsC52(requestContext: RequestContext): ByteArray {
val subscriber = requestContext.subscriber
- return constructCamtResponse(52, subscriber.bankCustomer.id.value,
requestContext.requestObject.header).toByteArray()
+ val camt = constructCamtResponse(52, subscriber.bankCustomer.id.value,
requestContext.requestObject.header)
+
+ val baos = ByteArrayOutputStream()
+ val asf =
ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, baos)
+ val zae = ZipArchiveEntry("Singleton C53 Entry")
+ asf.putArchiveEntry(zae)
+
+ val bais = ByteArrayInputStream(camt.toByteArray())
+ IOUtils.copy(bais, asf)
+ bais.close()
+ asf.closeArchiveEntry()
+ asf.finish()
+ baos.close()
+ return baos.toByteArray()
}
private suspend fun ApplicationCall.handleEbicsHia(header:
EbicsUnsecuredRequest.Header, orderData: ByteArray) {
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: implement compressed C53 responses,
gnunet <=