gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: cannot use wrapper elements


From: gnunet
Subject: [libeufin] branch master updated: cannot use wrapper elements
Date: Tue, 12 Nov 2019 14:35:19 +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 ff960f0  cannot use wrapper elements
ff960f0 is described below

commit ff960f0b7d662df5c7cff890ceabfdae61c8c1e3
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Nov 12 14:34:57 2019 +0100

    cannot use wrapper elements
---
 nexus/src/main/kotlin/Main.kt          | 16 +++++++++++++++-
 sandbox/src/test/kotlin/XmlUtilTest.kt | 15 ++++++++-------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index b9b45bd..3fd2f90 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -55,6 +55,7 @@ import javax.xml.bind.JAXBElement
 import org.w3c.dom.Document
 import java.security.SecureRandom
 import java.util.*
+import java.util.zip.InflaterInputStream
 import javax.xml.datatype.DatatypeFactory
 import javax.xml.datatype.XMLGregorianCalendar
 
@@ -108,7 +109,7 @@ fun chunkString(input: String): String {
 
 }
 
-fun expectId(param: String?) : Int {
+fun expectId(param: String?): Int {
 
     try {
         return param!!.toInt()
@@ -330,6 +331,19 @@ fun main() {
                     throw EbicsError(response.value.body.returnCode.value)
                 }
 
+                // extract payload
+
+                val er = CryptoUtil.EncryptionResult(
+                    
response.value.body.dataTransfer!!.dataEncryptionInfo!!.transactionKey,
+                    (response.value.body.dataTransfer!!.dataEncryptionInfo as 
EbicsTypes.DataEncryptionInfo)
+                        .encryptionPubKeyDigest.value,
+                    
Base64.getDecoder().decode(response.value.body.dataTransfer!!.orderData.value)
+                )
+
+                val dataCompr = CryptoUtil.decryptEbicsE002(er, 
CryptoUtil.loadRsaPrivateKey(encPrivBlob))
+                val data = 
EbicsOrderUtil.decodeOrderDataXml<HTDResponseOrderData>(dataCompr)
+                logger.debug("HTD payload is: 
${XMLUtil.convertJaxbToString(data)}")
+
                 val ackRequestDoc = transaction {
                     val subscriber = EbicsSubscriberEntity.findById(id) ?: 
throw SubscriberNotFoundError(HttpStatusCode.NotFound)
 
diff --git a/sandbox/src/test/kotlin/XmlUtilTest.kt 
b/sandbox/src/test/kotlin/XmlUtilTest.kt
index c55cb61..967ce58 100644
--- a/sandbox/src/test/kotlin/XmlUtilTest.kt
+++ b/sandbox/src/test/kotlin/XmlUtilTest.kt
@@ -5,6 +5,7 @@ import org.junit.Assert.*
 import org.junit.rules.ExpectedException
 import org.xml.sax.SAXParseException
 import tech.libeufin.schema.ebics_h004.EbicsKeyManagementResponse
+import tech.libeufin.schema.ebics_h004.EbicsTypes
 import tech.libeufin.schema.ebics_h004.HTDResponseOrderData
 import java.rmi.UnmarshalException
 import java.security.KeyPairGenerator
@@ -15,7 +16,9 @@ class XmlUtilTest {
 
     @Test
     fun deserializeConsecutiveLists() {
-        XMLUtil.convertStringToJaxb<HTDResponseOrderData>("""
+
+        // NOTE: this needs wrapping elements to be parsed into a JAXB object.
+        val tmp = XMLUtil.convertStringToJaxb<HTDResponseOrderData>("""
             <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
             <HTDResponseOrderData xmlns="urn:org:ebics:H004">
               <PartnerInfo>
@@ -25,7 +28,6 @@ class XmlUtilTest {
                 <BankInfo>
                   <HostID>host01</HostID>
                 </BankInfo>
-                <dogs>
                   <AccountInfo Currency="EUR" Description="ACCT" ID="acctid1">
                     <AccountNumber 
international="true">DE21500105174751659277</AccountNumber>
                     <BankCode international="true">INGDDEFFXXX</BankCode>
@@ -36,8 +38,6 @@ class XmlUtilTest {
                     <BankCode international="true">GENODEM1GLS</BankCode>
                     <AccountHolder>Mina Musterfrau</AccountHolder>
                   </AccountInfo>
-                </dogs>
-                <cats>
                   <OrderInfo>
                     <OrderType>C53</OrderType>
                     <TransferType>Download</TransferType>
@@ -53,9 +53,7 @@ class XmlUtilTest {
                     <TransferType>Upload</TransferType>
                     <Description>foo</Description>
                   </OrderInfo>
-                </cats>
               </PartnerInfo>
-                
               <UserInfo>
                 <UserID Status="5">USER1</UserID>
                 <Name>Some User</Name>
@@ -63,7 +61,10 @@ class XmlUtilTest {
                   <OrderTypes>C54 C53 C52 CCC</OrderTypes>
                 </Permission>
               </UserInfo>
-            </HTDResponseOrderData>""".trimIndent())
+            </HTDResponseOrderData>""".trimIndent()
+        )
+
+        logger.debug(tmp.value.partnerInfo.orderInfoList[0].description)
     }
 
     @Test

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



reply via email to

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