summaryrefslogtreecommitdiff
path: root/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
diff options
context:
space:
mode:
authorAntoine A <>2024-03-08 17:05:36 +0100
committerAntoine A <>2024-03-08 17:05:36 +0100
commit8b0ca3dbd7359a402b1671a7cb0fa37b92543d1e (patch)
tree8b18ca561bceb8e603d765cd56b1da0b169b65c8 /nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
parent854803e6510eed234844c1d58930ff74ee4f054e (diff)
downloadlibeufin-8b0ca3dbd7359a402b1671a7cb0fa37b92543d1e.tar.gz
libeufin-8b0ca3dbd7359a402b1671a7cb0fa37b92543d1e.tar.bz2
libeufin-8b0ca3dbd7359a402b1671a7cb0fa37b92543d1e.zip
Clean & reafactor & optimize
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt7
1 files changed, 2 insertions, 5 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
index 58e43e2d..e690dab8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
@@ -81,8 +81,8 @@ fun String.spaceEachTwo() =
* @return true if the user accepted, false otherwise.
*/
private fun askUserToAcceptKeys(bankKeys: BankPublicKeysFile): Boolean {
- val encHash = CryptoUtil.getEbicsPublicKeyHash(bankKeys.bank_encryption_public_key).toHexString()
- val authHash = CryptoUtil.getEbicsPublicKeyHash(bankKeys.bank_authentication_public_key).toHexString()
+ val encHash = CryptoUtil.getEbicsPublicKeyHash(bankKeys.bank_encryption_public_key).encodeUpHex()
+ val authHash = CryptoUtil.getEbicsPublicKeyHash(bankKeys.bank_authentication_public_key).encodeUpHex()
println("The bank has the following keys:")
println("Encryption key: ${encHash.spaceEachTwo()}")
println("Authentication key: ${authHash.spaceEachTwo()}")
@@ -158,9 +158,6 @@ suspend fun doKeysRequestAndUpdateState(
throw Exception("Could not POST the ${orderType.name} message to the bank at '${cfg.hostBaseUrl}'", e)
}
val ebics = parseKeysMgmtResponse(privs.encryption_private_key, xml)
- if (ebics == null) {
- throw Exception("Could not get any EBICS from the bank ${orderType.name} response ($xml).")
- }
if (ebics.technicalReturnCode != EbicsReturnCode.EBICS_OK) {
throw Exception("EBICS ${orderType.name} failed with code: ${ebics.technicalReturnCode}")
}