summaryrefslogtreecommitdiff
path: root/nexus/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'nexus/src/main')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/KeyFiles.kt4
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/PDF.kt2
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsConstants.kt9
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsKeyMng.kt6
4 files changed, 14 insertions, 7 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/KeyFiles.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/KeyFiles.kt
index fd91cfd4..b4acbb75 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/KeyFiles.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/KeyFiles.kt
@@ -58,7 +58,7 @@ object RSAPublicKeySerializer : KSerializer<RSAPublicKey> {
override fun deserialize(decoder: Decoder): RSAPublicKey {
val fieldValue = decoder.decodeString()
val bytes = Base32Crockford.decode(fieldValue)
- return CryptoUtil.loadRsaPublicKey(bytes)
+ return CryptoUtil.loadRSAPublic(bytes)
}
}
@@ -76,7 +76,7 @@ object RSAPrivateCrtKeySerializer : KSerializer<RSAPrivateCrtKey> {
override fun deserialize(decoder: Decoder): RSAPrivateCrtKey {
val fieldValue = decoder.decodeString()
val bytes = Base32Crockford.decode(fieldValue)
- return CryptoUtil.loadRsaPrivateKey(bytes)
+ return CryptoUtil.loadRSAPrivate(bytes)
}
}
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/PDF.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/PDF.kt
index a485477c..dd595d31 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/PDF.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/PDF.kt
@@ -73,7 +73,7 @@ fun generateKeysPdf(
}
fun writeKey(doc: Document, priv: RSAPrivateCrtKey) {
- val pub = CryptoUtil.getRsaPublicFromPrivate(priv)
+ val pub = CryptoUtil.RSAPublicFromPrivate(priv)
val hash = CryptoUtil.getEbicsPublicKeyHash(pub)
doc.add(Paragraph("Exponent:\n${formatHex(pub.publicExponent.toByteArray())}"))
doc.add(Paragraph("Modulus:\n${formatHex(pub.modulus.toByteArray())}"))
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsConstants.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsConstants.kt
index fc217c2a..8841866f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsConstants.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsConstants.kt
@@ -46,9 +46,16 @@ enum class EbicsReturnCode(val code: String) {
EBICS_TX_SEGMENT_NUMBER_EXCEEDED("091104"),
EBICS_INVALID_REQUEST_CONTENT("091113"),
EBICS_PROCESSING_ERROR("091116"),
-
// Key-Management errors
+ EBICS_KEYMGMT_UNSUPPORTED_VERSION_SIGNATURE("091201"),
+ EBICS_KEYMGMT_UNSUPPORTED_VERSION_AUTHENTICATION("091202"),
+ EBICS_KEYMGMT_UNSUPPORTED_VERSION_ENCRYPTION("091203"),
+ EBICS_KEYMGMT_KEYLENGTH_ERROR_SIGNATURE("091204"),
+ EBICS_KEYMGMT_KEYLENGTH_ERROR_AUTHENTICATION("091205"),
+ EBICS_KEYMGMT_KEYLENGTH_ERROR_ENCRYPTION("091206"),
+ EBICS_X509_CERTIFICATE_EXPIRED("091208"),
+ EBICS_X509_CERTIFICATE_NOT_VALID_YET("091209"),
EBICS_X509_WRONG_KEY_USAGE("091210"),
EBICS_X509_WRONG_ALGORITHM("091211"),
EBICS_X509_INVALID_THUMBPRINT("091212"),
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsKeyMng.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsKeyMng.kt
index 02db79a0..9141430a 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsKeyMng.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsKeyMng.kt
@@ -111,7 +111,7 @@ class EbicsKeyMng(
private fun XmlBuilder.RSAKeyXml(key: RSAPrivateCrtKey) {
if (ebics3) {
- val cert = CryptoUtil.certificateFromPrivate(key)
+ val cert = CryptoUtil.X509CertificateFromRSAPrivate(key, cfg.myIbanAccount.name)
el("ds:X509Data") {
el("ds:X509Certificate", cert.encoded.encodeBase64())
}
@@ -175,10 +175,10 @@ class EbicsKeyMng(
fun XmlDestructor.rsaPubKey(): RSAPublicKey {
val cert = opt("X509Data")?.one("X509Certificate")?.text()?.decodeBase64()
return if (cert != null) {
- CryptoUtil.loadRsaPublicKeyFromCertificate(cert)
+ CryptoUtil.RSAPublicFromCertificate(cert)
} else {
one("PubKeyValue").one("RSAKeyValue") {
- CryptoUtil.loadRsaPublicKeyFromComponents(
+ CryptoUtil.RSAPublicFromComponents(
one("Modulus").text().decodeBase64(),
one("Exponent").text().decodeBase64(),
)