commit 9b7cad4415ba5ef31b96840a50710aa4310fd5f0
parent 1a8c7ebef9507dc8368b8c3ad12d040ff1db9d3d
Author: MS <ms@taler.net>
Date: Thu, 25 May 2023 11:51:48 +0200
Reserve pub. extractor.
Testing whether zeros and Os are treated
interchangeably.
Diffstat:
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/nexus/src/test/kotlin/SubjectNormalization.kt b/nexus/src/test/kotlin/SubjectNormalization.kt
@@ -1,4 +1,5 @@
import org.junit.Test
+import tech.libeufin.util.CryptoUtil
import tech.libeufin.util.extractReservePubFromSubject
class SubjectNormalization {
@@ -10,5 +11,24 @@ class SubjectNormalization {
assert(mereValue == extractReservePubFromSubject("noise before ${mereValue} noise after"))
val mereValueNewLines = "\t1ENVZ6EYGB6Z\n\n\n509KRJ6E59GK1EQXZF8XXNY9\nSN33C2KDGSHV9KA0"
assert(mereValue == extractReservePubFromSubject(mereValueNewLines))
+ assert(mereValue == extractReservePubFromSubject("noise before $mereValueNewLines noise after"))
+ }
+
+ /**
+ * Here we test whether the value that the extractor picks
+ * from a payment subjects is then validated by the crypto backend.
+ */
+ @Test
+ fun extractorVsDecoder() {
+ val validPub = "7R422Z6C5TPG0JM32KRWV093J0AG0GVZV1247F9PBSFZT6Y61G1G"
+ assert(CryptoUtil.checkValidEddsaPublicKey(validPub))
+ // Swapping zeros with Os.
+ assert(CryptoUtil.checkValidEddsaPublicKey(validPub.replace('0', 'O')))
+ // At this point, the decoder handles 0s and Os interchangeably.
+ // Now check that the reserve pub. extractor behaves equally.
+ val extractedPub = extractReservePubFromSubject(validPub) // has 0s.
+ assert(CryptoUtil.checkValidEddsaPublicKey(extractedPub!!))
+ val extractedPubWithOs = extractReservePubFromSubject(validPub.replace('0', 'O'))
+ assert(CryptoUtil.checkValidEddsaPublicKey(extractedPubWithOs!!))
}
}
\ No newline at end of file
diff --git a/util/src/main/kotlin/XMLUtil.kt b/util/src/main/kotlin/XMLUtil.kt
@@ -226,7 +226,6 @@ class XMLUtil private constructor() {
}
}
- // FIXME: need here the "2019" Swiss versions of camt and pain.
val schemaInputs: Array<Source> = listOf(
"xsd/ebics_H004.xsd",
"xsd/ebics_hev.xsd",