[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libeufin] branch master updated: catch bad key exception
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libeufin] branch master updated: catch bad key exception |
Date: |
Thu, 17 Oct 2019 11:08:08 +0200 |
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 9f9c587 catch bad key exception
9f9c587 is described below
commit 9f9c5878df52ad3c12d5743218685d896ee80294
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Oct 17 11:07:56 2019 +0200
catch bad key exception
---
sandbox/src/main/kotlin/Main.kt | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/sandbox/src/main/kotlin/Main.kt b/sandbox/src/main/kotlin/Main.kt
index 21b0520..df930a5 100644
--- a/sandbox/src/main/kotlin/Main.kt
+++ b/sandbox/src/main/kotlin/Main.kt
@@ -52,6 +52,7 @@ import java.util.*
import java.util.zip.GZIPInputStream
import javax.xml.bind.JAXBElement
import java.nio.charset.StandardCharsets.UTF_8
+import java.security.InvalidKeyException
import java.security.KeyFactory
import java.security.PublicKey
import java.security.interfaces.RSAPublicKey
@@ -236,6 +237,7 @@ private suspend fun ApplicationCall.ebicsweb() {
HttpStatusCode.NotFound,
SandboxError("Unknown HostID specified")
)
+ return
}
when (bodyDocument.documentElement.localName) {
@@ -298,19 +300,27 @@ private suspend fun ApplicationCall.ebicsweb() {
result.toString(US_ASCII)
)
- // get the customer id
- val ebicsUserId = bodyJaxb.value.header.static.userID
+ try {
+ loadRsaPublicKey(
+
keyObject.value.signaturePubKeyInfo.pubKeyValue.rsaKeyValue.exponent,
+
keyObject.value.signaturePubKeyInfo.pubKeyValue.rsaKeyValue.modulus
+ )
+ } catch (e: Exception) {
+ logger.info("User gave bad key, not storing it")
+ e.printStackTrace()
+ respond(
+ HttpStatusCode.BadRequest,
+ SandboxError("Bad public key given")
+ )
+ return
+ }
- // get key modulus and exponent
- // (do sanity check on the key - see if it loads)
+ logger.debug(EbicsUsers.userId.name)
- val publicKeyy = loadRsaPublicKey(
-
keyObject.value.signaturePubKeyInfo.pubKeyValue.rsaKeyValue.modulus,
-
keyObject.value.signaturePubKeyInfo.pubKeyValue.rsaKeyValue.exponent
- )
// store key in database
+
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libeufin] branch master updated: catch bad key exception,
gnunet <=