gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: letter tweaks / fix key confusion


From: gnunet
Subject: [libeufin] branch master updated: letter tweaks / fix key confusion
Date: Thu, 30 Jan 2020 15:44:03 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new e9ab70b  letter tweaks / fix key confusion
e9ab70b is described below

commit e9ab70b4e0e598baeb4b4033f407640d5236c95c
Author: Florian Dold <address@hidden>
AuthorDate: Thu Jan 30 15:43:57 2020 +0100

    letter tweaks / fix key confusion
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt |  7 ++++---
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt    | 18 ++++++++++++------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
index 99176e6..df64b63 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
@@ -133,7 +133,7 @@ fun containerInit(subscriber: EbicsSubscriberEntity): 
EbicsContainer {
 
         customerSignPriv = 
CryptoUtil.loadRsaPrivateKey(subscriber.signaturePrivateKey.toByteArray()),
         customerAuthPriv = 
CryptoUtil.loadRsaPrivateKey(subscriber.authenticationPrivateKey.toByteArray()),
-        customerEncPriv = 
CryptoUtil.loadRsaPrivateKey(subscriber.authenticationPrivateKey.toByteArray())
+        customerEncPriv = 
CryptoUtil.loadRsaPrivateKey(subscriber.encryptionPrivateKey.toByteArray())
     )
 }
 
@@ -145,7 +145,7 @@ fun chunkString(input: String): String {
     var columns = 0
     for (i in input.indices) {
         if ((i + 1).rem(2) == 0) {
-            if (columns == 7) {
+            if (columns == 15) {
                 ret.append(input[i] + "\n")
                 columns = 0
                 continue
@@ -156,7 +156,7 @@ fun chunkString(input: String): String {
         }
         ret.append(input[i])
     }
-    return ret.toString()
+    return ret.toString().toUpperCase()
 }
 
 fun expectId(param: String?): String {
@@ -247,6 +247,7 @@ suspend inline fun <reified T, reified S> 
HttpClient.postToBankSigned(
     val doc = XMLUtil.convertJaxbToDocument(body)
     XMLUtil.signEbicsDocument(doc, priv)
     val response: String = this.postToBank(url, 
XMLUtil.convertDomToString(doc))
+    println("bank response: $response")
     try {
         return XMLUtil.convertStringToJaxb(response)
     } catch (e: Exception) {
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 63f3bd4..6bdab04 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -315,9 +315,10 @@ fun main() {
                 val encVersionLine = "E002"
                 val now = Date()
                 val dateFormat = SimpleDateFormat("DD.MM.YYYY")
-                val timeFormat = SimpleDateFormat("HH.mm.ss")
-                var dateLine = dateFormat.format(now)
-                var timeLine = timeFormat.format(now)
+                val timeFormat = SimpleDateFormat("HH:mm:ss")
+                val dateLine = dateFormat.format(now)
+                val timeLine = timeFormat.format(now)
+                var hostID = ""
                 transaction {
                     val subscriber = EbicsSubscriberEntity.findById(id) ?: 
throw SubscriberNotFoundError(
                         HttpStatusCode.NotFound
@@ -331,6 +332,7 @@ fun main() {
                     val encPubTmp = CryptoUtil.getRsaPublicFromPrivate(
                         
CryptoUtil.loadRsaPrivateKey(subscriber.encryptionPrivateKey.toByteArray())
                     )
+                    hostID = subscriber.hostID
                     userIdLine = subscriber.userID
                     esExponentLine = 
signPubTmp.publicExponent.toByteArray().toHexString()
                     esModulusLine = 
signPubTmp.modulus.toByteArray().toHexString()
@@ -347,8 +349,9 @@ fun main() {
                     |Date: ${dateLine}
                     |Time: ${timeLine}
                     |Recipient: ${recipientLine}
+                    |Host ID: ${hostID}
                     |User ID: ${userIdLine}
-                    |Customer ID: ${customerIdLine}
+                    |Partner ID: ${customerIdLine}
                     |ES version: ${esVersionLine}
                     
                     |Public key for the electronic signature:
@@ -369,6 +372,7 @@ fun main() {
                     
                     |__________
                     |Signature
+                    |
                 """.trimMargin()
 
                 val hiaLetter = """
@@ -376,8 +380,9 @@ fun main() {
                     |Date: ${dateLine}
                     |Time: ${timeLine}
                     |Recipient: ${recipientLine}
+                    |Host ID: ${hostID}
                     |User ID: ${userIdLine}
-                    |Customer ID: ${customerIdLine}
+                    |Partner ID: ${customerIdLine}
                     |Identification and authentication signature version: 
${authVersionLine}
                     |Encryption version: ${encVersionLine}
                     
@@ -410,6 +415,7 @@ fun main() {
                     
                     |__________
                     |Signature
+                    |
                 """.trimMargin()
 
                 call.respondText(
@@ -682,7 +688,7 @@ fun main() {
                         usd_encrypted
                     ),
                     subscriberData.bankAuthPub!!,
-                    subscriberData.customerEncPriv
+                    subscriberData.customerAuthPriv
                 )
                 if (response.value.body.returnCode.value != "000000") {
                     throw EbicsError(response.value.body.returnCode.value)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]