gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (9f46405 -> e22d477)


From: gnunet
Subject: [libeufin] branch master updated (9f46405 -> e22d477)
Date: Fri, 01 Nov 2019 11:18:34 +0100

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

dold pushed a change to branch master
in repository libeufin.

 discard 9f46405  project structure
     new e22d477  project structure

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (9f46405)
            \
             N -- N -- N   refs/heads/master (e22d477)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 sandbox/src/main/kotlin/DB.kt                      |  5 --
 sandbox/src/main/kotlin/Main.kt                    | 59 ++++------------------
 .../libeufin/schema/ebics_h004/EbicsMessages.kt    | 42 ---------------
 sandbox/src/test/kotlin/EbicsMessagesTest.kt       | 24 ++++-----
 4 files changed, 19 insertions(+), 111 deletions(-)

diff --git a/sandbox/src/main/kotlin/DB.kt b/sandbox/src/main/kotlin/DB.kt
index e869a58..ca95151 100644
--- a/sandbox/src/main/kotlin/DB.kt
+++ b/sandbox/src/main/kotlin/DB.kt
@@ -22,7 +22,6 @@ package tech.libeufin.sandbox.db
 import org.jetbrains.exposed.dao.*
 import org.jetbrains.exposed.sql.*
 import org.jetbrains.exposed.sql.transactions.transaction
-import java.sql.Blob
 
 const val CUSTOMER_NAME_MAX_LENGTH = 20
 const val EBICS_HOST_ID_MAX_LENGTH = 10
@@ -82,10 +81,6 @@ enum class KeyState {
     RELEASED
 }
 
-fun Blob.toByteArray(): ByteArray {
-    return this.binaryStream.readAllBytes()
-}
-
 /**
  * This table information *not* related to EBICS, for all
  * its customers.
diff --git a/sandbox/src/main/kotlin/Main.kt b/sandbox/src/main/kotlin/Main.kt
index 345593c..6b94078 100644
--- a/sandbox/src/main/kotlin/Main.kt
+++ b/sandbox/src/main/kotlin/Main.kt
@@ -46,7 +46,6 @@ import org.slf4j.LoggerFactory
 import org.w3c.dom.Document
 import tech.libeufin.sandbox.db.*
 import tech.libeufin.schema.ebics_h004.EbicsKeyManagementResponse
-import tech.libeufin.schema.ebics_h004.EbicsNoPubKeyDigestsRequest
 import tech.libeufin.schema.ebics_h004.EbicsUnsecuredRequest
 import tech.libeufin.schema.ebics_h004.HIARequestOrderDataType
 import tech.libeufin.schema.ebics_hev.HEVResponse
@@ -69,8 +68,8 @@ private suspend fun ApplicationCall.respondEbicsKeyManagement(
     errorText: String,
     errorCode: String,
     statusCode: HttpStatusCode,
-    bankReturnCode: String,
-    orderId: String? = null
+    orderId: String? = null,
+    bankReturnCode: String? = null
 ) {
     val responseXml = EbicsKeyManagementResponse().apply {
         version = "H004"
@@ -86,9 +85,11 @@ private suspend fun 
ApplicationCall.respondEbicsKeyManagement(
             _static = EbicsKeyManagementResponse.Header.EmptyStaticHeader()
         }
         body = EbicsKeyManagementResponse.Body().apply {
-            this.returnCode = 
EbicsKeyManagementResponse.Body.ReturnCode().apply {
-                this.authenticate = true
-                this.value = bankReturnCode
+            if (bankReturnCode != null) {
+                this.returnCode = 
EbicsKeyManagementResponse.Body.ReturnCode().apply {
+                    this.authenticate = true
+                    this.value = bankReturnCode
+                }
             }
         }
     }
@@ -99,7 +100,7 @@ private suspend fun 
ApplicationCall.respondEbicsKeyManagement(
 
 
 private suspend fun ApplicationCall.respondEbicsInvalidXml() {
-    respondEbicsKeyManagement("[EBICS_INVALID_XML]", "091010", 
HttpStatusCode.BadRequest, "000000")
+    respondEbicsKeyManagement("[EBICS_INVALID_XML]", "091010", 
HttpStatusCode.BadRequest)
 }
 
 
@@ -117,12 +118,6 @@ fun findEbicsSubscriber(partnerID: String, userID: String, 
systemID: String?): E
     }.firstOrNull()
 }
 
-data class SubscriberKeys(
-    val authenticationPublicKey: RSAPublicKey,
-    val encryptionPublicKey: RSAPublicKey,
-    val signaturePublicKey: RSAPublicKey
-)
-
 private suspend fun ApplicationCall.ebicsweb() {
     val body: String = receiveText()
     logger.debug("Data received: $body")
@@ -153,7 +148,7 @@ private suspend fun ApplicationCall.ebicsweb() {
 
             if (ebicsHost == null) {
                 logger.warn("client requested unknown HostID")
-                respondEbicsKeyManagement("[EBICS_INVALID_HOST_ID]", "091011", 
HttpStatusCode.NotFound, "000000")
+                respondEbicsKeyManagement("[EBICS_INVALID_HOST_ID]", "091011", 
HttpStatusCode.NotFound)
                 return
             }
 
@@ -299,8 +294,7 @@ private suspend fun ApplicationCall.ebicsweb() {
                             ebicsSubscriber.state = SubscriberState.INITIALIZED
                         }
                     }
-                    respondEbicsKeyManagement("[EBICS_OK]", "000000", 
HttpStatusCode.OK, "000000")
-                    return
+                    respondEbicsKeyManagement("[EBICS_OK]", "000000", 
HttpStatusCode.OK)
                 }
             }
 
@@ -320,39 +314,6 @@ private suspend fun ApplicationCall.ebicsweb() {
             respondText(strResp, ContentType.Application.Xml, 
HttpStatusCode.OK)
             return
         }
-        "ebicsNoPubKeyDigestsRequest" -> {
-            val requestJaxb = 
XMLUtil.convertDomToJaxb(EbicsNoPubKeyDigestsRequest::class.java, bodyDocument)
-            val staticHeader = requestJaxb.value.header.static
-            val orderType = staticHeader.orderDetails.orderType
-            when (orderType) {
-                "HPB" -> {
-                    val subscriberKeys = transaction {
-                        val ebicsSubscriber =
-                            findEbicsSubscriber(staticHeader.partnerID, 
staticHeader.userID, staticHeader.systemID)
-                        if (ebicsSubscriber == null) {
-                            throw 
EbicsRequestError(HttpStatusCode.Unauthorized)
-                        }
-                        if (ebicsSubscriber.state != 
SubscriberState.INITIALIZED) {
-                            throw EbicsRequestError(HttpStatusCode.Forbidden)
-                        }
-                        val authPubBlob = 
ebicsSubscriber.authenticationKey!!.rsaPublicKey
-                        val encPubBlob = 
ebicsSubscriber.encryptionKey!!.rsaPublicKey
-                        val sigPubBlob = 
ebicsSubscriber.signatureKey!!.rsaPublicKey
-                        SubscriberKeys(
-                            
CryptoUtil.loadRsaPublicKey(authPubBlob.toByteArray()),
-                            
CryptoUtil.loadRsaPublicKey(encPubBlob.toByteArray()),
-                            
CryptoUtil.loadRsaPublicKey(sigPubBlob.toByteArray())
-                        )
-                    }
-                    val validationResult = 
XMLUtil.verifyEbicsDocument(bodyDocument, subscriberKeys.signaturePublicKey)
-                    logger.info("validationResult: $validationResult")
-                }
-                else -> {
-                    logger.warn("order type '${orderType}' not supported for 
ebicsNoPubKeyDigestsRequest")
-                    respondEbicsInvalidXml()
-                }
-            }
-        }
         else -> {
             /* Log to console and return "unknown type" */
             logger.info("Unknown message, just logging it!")
diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsMessages.kt 
b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsMessages.kt
index f98d65f..e964f21 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsMessages.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsMessages.kt
@@ -540,45 +540,3 @@ class EbicsKeyManagementResponse {
         }
     }
 }
-
-
-@XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "", propOrder = ["header", "authSignature", "body"])
-@XmlRootElement(name = "ebicsNoPubKeyDigestsRequest")
-class EbicsNoPubKeyDigestsRequest {
-    @get:XmlAttribute(name = "Version", required = true)
-    @get:XmlJavaTypeAdapter(CollapsedStringAdapter::class)
-    lateinit var version: String
-
-    @get:XmlAttribute(name = "Revision")
-    var revision: Int? = null
-
-    @get:XmlElement(name = "header", required = true)
-    lateinit var header: Header
-
-    @get:XmlElement(name = "AuthSignature", required = true)
-    lateinit var authSignature: SignatureType
-
-    @get:XmlElement(required = true)
-    lateinit var body: EmptyBody
-
-    @XmlAccessorType(XmlAccessType.NONE)
-    @XmlType(name = "", propOrder = ["static", "mutable"])
-    class Header {
-        @get:XmlAttribute(name = "authenticate", required = true)
-        var authenticate: Boolean = false
-
-        @get:XmlElement(name = "static", required = true)
-        lateinit var static: StaticHeader
-
-        @get:XmlElement(required = true)
-        lateinit var mutable: EmptyMutableHeader
-
-        @XmlAccessorType(XmlAccessType.NONE)
-        @XmlType(name = "")
-        class EmptyMutableHeader
-    }
-
-    @XmlAccessorType(XmlAccessType.NONE)
-    class EmptyBody
-}
\ No newline at end of file
diff --git a/sandbox/src/test/kotlin/EbicsMessagesTest.kt 
b/sandbox/src/test/kotlin/EbicsMessagesTest.kt
index 20f7b20..afc8f0e 100644
--- a/sandbox/src/test/kotlin/EbicsMessagesTest.kt
+++ b/sandbox/src/test/kotlin/EbicsMessagesTest.kt
@@ -18,7 +18,7 @@ class EbicsMessagesTest {
      * messages.
      */
     @Test
-    fun testImportNonRoot() {
+    fun importNonRoot() {
         val classLoader = ClassLoader.getSystemClassLoader()
         val ini = classLoader.getResource("ebics_ini_inner_key.xml")
         val jaxb = 
XMLUtil.convertStringToJaxb<SignaturePubKeyOrderData>(ini.readText())
@@ -29,7 +29,7 @@ class EbicsMessagesTest {
      * Test string -> JAXB
      */
     @Test
-    fun testStringToJaxb() {
+    fun stringToJaxb() {
         val classLoader = ClassLoader.getSystemClassLoader()
         val ini = classLoader.getResource("ebics_ini_request_sample.xml")
         val jaxb = 
XMLUtil.convertStringToJaxb<EbicsUnsecuredRequest>(ini.readText())
@@ -44,7 +44,7 @@ class EbicsMessagesTest {
      * Test JAXB -> string
      */
     @Test
-    fun testJaxbToString() {
+    fun jaxbToString() {
         val hevResponseJaxb = HEVResponse().apply {
             this.systemReturnCode = SystemReturnCodeType().apply {
                 this.reportText = "[EBICS_OK]"
@@ -55,11 +55,12 @@ class EbicsMessagesTest {
         XMLUtil.convertJaxbToString(hevResponseJaxb)
     }
 
+
     /**
      * Test DOM -> JAXB
      */
     @Test
-    fun testDomToJaxb() {
+    fun domToJaxb() {
         val classLoader = ClassLoader.getSystemClassLoader()
         val ini = classLoader.getResource("ebics_ini_request_sample.xml")!!
         val iniDom = XMLUtil.parseStringIntoDom(ini.readText())
@@ -99,7 +100,7 @@ class EbicsMessagesTest {
     }
 
     @Test
-    fun testHiaLoad() {
+    fun hiaLoad() {
         val classLoader = ClassLoader.getSystemClassLoader()
         val hia = classLoader.getResource("hia_request.xml")!!
         val hiaDom = XMLUtil.parseStringIntoDom(hia.readText())
@@ -121,7 +122,7 @@ class EbicsMessagesTest {
     }
 
     @Test
-    fun testLoadInnerKey() {
+    fun loadInnerKey() {
         val jaxbKey = run {
             val classLoader = ClassLoader.getSystemClassLoader()
             val file = classLoader.getResource(
@@ -137,14 +138,14 @@ class EbicsMessagesTest {
     }
 
     @Test
-    fun testLoadIniMessage() {
+    fun loadIniMessage() {
         val classLoader = ClassLoader.getSystemClassLoader()
         val text = 
classLoader.getResource("ebics_ini_request_sample.xml")!!.readText()
         XMLUtil.convertStringToJaxb<EbicsUnsecuredRequest>(text)
     }
 
     @Test
-    fun testLoadResponse() {
+    fun loadResponse() {
         val response = EbicsResponse().apply {
             version = "H004"
             header = EbicsResponse.Header().apply {
@@ -165,11 +166,4 @@ class EbicsMessagesTest {
         }
         print(XMLUtil.convertJaxbToString(response))
     }
-
-    @Test
-    fun testLoadHpb() {
-        val classLoader = ClassLoader.getSystemClassLoader()
-        val text = classLoader.getResource("hpb_request.xml")!!.readText()
-        XMLUtil.convertStringToJaxb<EbicsNoPubKeyDigestsRequest>(text)
-    }
 }
\ No newline at end of file

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



reply via email to

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