diff options
author | Antoine A <> | 2024-03-11 17:14:24 +0100 |
---|---|---|
committer | Antoine A <> | 2024-03-11 17:14:24 +0100 |
commit | 0d62875dd2287857c5da172dcb3301062880810a (patch) | |
tree | 6880751fb475a9f0db8dcedbf8ef8e78a299f729 /nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt | |
parent | 861389ea98224e86f28fdf06570a260c3ae12f90 (diff) | |
download | libeufin-0d62875dd2287857c5da172dcb3301062880810a.tar.gz libeufin-0d62875dd2287857c5da172dcb3301062880810a.tar.bz2 libeufin-0d62875dd2287857c5da172dcb3301062880810a.zip |
Support both 2.5 and 3 EBICS version for download
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt')
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt index bbae68ae..2893f367 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/XMLUtil.kt @@ -113,11 +113,10 @@ object XMLUtil { fun signEbicsDocument( doc: Document, signingPriv: PrivateKey, - withEbics3: Boolean = false + schema: String ) { - val ns = if (withEbics3) "urn:org:ebics:H005" else "urn:org:ebics:H004" val authSigNode = XPathFactory.newInstance().newXPath() - .evaluate("/*[1]/$ns:AuthSignature", doc, XPathConstants.NODE) + .evaluate("/*[1]/urn:org:ebics:$schema:AuthSignature", doc, XPathConstants.NODE) if (authSigNode !is Node) throw java.lang.Exception("no AuthSignature") val fac = XMLSignatureFactory.getInstance("DOM") @@ -150,12 +149,11 @@ object XMLUtil { fun verifyEbicsDocument( doc: Document, signingPub: PublicKey, - withEbics3: Boolean = false + schema: String ): Boolean { val doc2: Document = doc.cloneNode(true) as Document - val ns = if (withEbics3) "urn:org:ebics:H005" else "urn:org:ebics:H004" val authSigNode = XPathFactory.newInstance().newXPath() - .evaluate("/*[1]/$ns:AuthSignature", doc2, XPathConstants.NODE) + .evaluate("/*[1]/urn:org:ebics:$schema:AuthSignature", doc2, XPathConstants.NODE) if (authSigNode !is Node) throw java.lang.Exception("no AuthSignature") val sigEl = doc2.createElementNS("http://www.w3.org/2000/09/xmldsig#", "ds:Signature") |