[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: decrypt result from bank
From: |
gnunet |
Subject: |
[libeufin] branch master updated: decrypt result from bank |
Date: |
Thu, 07 Nov 2019 21:00:06 +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 6cb403f decrypt result from bank
6cb403f is described below
commit 6cb403f8e8caa481c475f42006e9bbd115f88e30
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Nov 7 20:59:48 2019 +0100
decrypt result from bank
---
nexus/src/main/kotlin/Main.kt | 22 +++++++++++++++++++---
.../kotlin/tech/libeufin/sandbox/CryptoUtil.kt | 2 +-
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index 03016ec..ae2a7a8 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -322,7 +322,7 @@ fun main() {
// _parse_ response!
// respond to client
val id = expectId(call.parameters["id"])
- val (url, body) = transaction {
+ val (url, body, encPriv) = transaction {
val subscriber = EbicsSubscriberEntity.findById(id) ?:
throw SubscriberNotFoundError(HttpStatusCode.NotFound)
val hpbRequest = EbicsNpkdRequest().apply {
version = "H004"
@@ -351,10 +351,26 @@ fun main() {
hpbDoc,
CryptoUtil.loadRsaPrivateKey(subscriber.signaturePrivateKey.toByteArray())
)
- Pair(subscriber.ebicsURL, hpbDoc)
+ Triple(subscriber.ebicsURL, hpbDoc,
subscriber.encryptionPrivateKey)
}
- val response =
client.postToBank<EbicsKeyManagementResponse>(url, body)
+ val response =
client.postToBank<EbicsKeyManagementResponse>(url, body) ?: throw
UnreachableBankError(
+ HttpStatusCode.InternalServerError
+ )
+
+ if (response.value.body.returnCode.value != "000000") {
+ throw EbicsError(response.value.body.returnCode.value)
+ }
+
+ val er = CryptoUtil.EncryptionResult(
+
response.value.body.dataTransfer!!.dataEncryptionInfo!!.transactionKey,
+ (response.value.body.dataTransfer!!.dataEncryptionInfo as
EbicsTypes.DataEncryptionInfo)
+ .encryptionPubKeyDigest.value,
+ (response.value.body.dataTransfer as
EbicsKeyManagementResponse.OrderData).value
+ )
+
+ var dataCompr = CryptoUtil.decryptEbicsE002(er,
CryptoUtil.loadRsaPrivateKey(encPriv.toByteArray()))
+ var data =
EbicsOrderUtil.decodeOrderDataXml<HPBResponseOrderData>(dataCompr)
call.respond(HttpStatusCode.NotImplemented, NexusError("work
in progress"))
return@post
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CryptoUtil.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CryptoUtil.kt
index db4eee5..93be1be 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CryptoUtil.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CryptoUtil.kt
@@ -43,7 +43,7 @@ import javax.crypto.spec.SecretKeySpec
data class RsaCrtKeyPair(val private: RSAPrivateCrtKey, val public:
RSAPublicKey)
/**
- * Helpers for dealing with crypographic operations in EBICS / LibEuFin.
+ * Helpers for dealing with cryptographic operations in EBICS / LibEuFin.
*/
class CryptoUtil {
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: decrypt result from bank,
gnunet <=