summaryrefslogtreecommitdiff
path: root/nexus/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'nexus/src/test')
-rw-r--r--nexus/src/test/kotlin/CliTest.kt4
-rw-r--r--nexus/src/test/kotlin/Keys.kt4
-rw-r--r--nexus/src/test/kotlin/MySerializers.kt12
-rw-r--r--nexus/src/test/kotlin/helpers.kt8
4 files changed, 14 insertions, 14 deletions
diff --git a/nexus/src/test/kotlin/CliTest.kt b/nexus/src/test/kotlin/CliTest.kt
index 7e03053d..19bc0853 100644
--- a/nexus/src/test/kotlin/CliTest.kt
+++ b/nexus/src/test/kotlin/CliTest.kt
@@ -103,8 +103,8 @@ class CliTest {
}
// Unfinished bank
persistBankKeys(BankPublicKeysFile(
- bank_authentication_public_key = CryptoUtil.generateRsaKeyPair(2048).public,
- bank_encryption_public_key = CryptoUtil.generateRsaKeyPair(2048).public,
+ bank_authentication_public_key = CryptoUtil.genRSAPublic(2048),
+ bank_encryption_public_key = CryptoUtil.genRSAPublic(2048),
accepted = false
), bankKeysPath)
for (cmd in cmds) {
diff --git a/nexus/src/test/kotlin/Keys.kt b/nexus/src/test/kotlin/Keys.kt
index 826ec77e..36dd6487 100644
--- a/nexus/src/test/kotlin/Keys.kt
+++ b/nexus/src/test/kotlin/Keys.kt
@@ -43,8 +43,8 @@ class PublicKeys {
// artificially creating the keys.
val fileContent = BankPublicKeysFile(
accepted = true,
- bank_authentication_public_key = CryptoUtil.generateRsaKeyPair(2028).public,
- bank_encryption_public_key = CryptoUtil.generateRsaKeyPair(2028).public
+ bank_authentication_public_key = CryptoUtil.genRSAPublic(2028),
+ bank_encryption_public_key = CryptoUtil.genRSAPublic(2028)
)
// storing them on disk.
persistBankKeys(fileContent, Path("/tmp/nexus-tests-bank-keys.json"))
diff --git a/nexus/src/test/kotlin/MySerializers.kt b/nexus/src/test/kotlin/MySerializers.kt
index 98707948..1f2d8969 100644
--- a/nexus/src/test/kotlin/MySerializers.kt
+++ b/nexus/src/test/kotlin/MySerializers.kt
@@ -28,9 +28,9 @@ class MySerializers {
// Testing deserialization of RSA private keys.
@Test
fun rsaPrivDeserialization() {
- val s = Base32Crockford.encode(CryptoUtil.generateRsaKeyPair(2048).private.encoded)
- val a = Base32Crockford.encode(CryptoUtil.generateRsaKeyPair(2048).private.encoded)
- val e = Base32Crockford.encode(CryptoUtil.generateRsaKeyPair(2048).private.encoded)
+ val s = Base32Crockford.encode(CryptoUtil.genRSAPrivate(2048).encoded)
+ val a = Base32Crockford.encode(CryptoUtil.genRSAPrivate(2048).encoded)
+ val e = Base32Crockford.encode(CryptoUtil.genRSAPrivate(2048).encoded)
val obj = JSON.decodeFromString<ClientPrivateKeysFile>("""
{
"signature_private_key": "$s",
@@ -40,8 +40,8 @@ class MySerializers {
"submitted_hia": true
}
""".trimIndent())
- assertEquals(obj.signature_private_key, CryptoUtil.loadRsaPrivateKey(Base32Crockford.decode(s)))
- assertEquals(obj.authentication_private_key, CryptoUtil.loadRsaPrivateKey(Base32Crockford.decode(a)))
- assertEquals(obj.encryption_private_key, CryptoUtil.loadRsaPrivateKey(Base32Crockford.decode(e)))
+ assertEquals(obj.signature_private_key, CryptoUtil.loadRSAPrivate(Base32Crockford.decode(s)))
+ assertEquals(obj.authentication_private_key, CryptoUtil.loadRSAPrivate(Base32Crockford.decode(a)))
+ assertEquals(obj.encryption_private_key, CryptoUtil.loadRSAPrivate(Base32Crockford.decode(e)))
}
} \ No newline at end of file
diff --git a/nexus/src/test/kotlin/helpers.kt b/nexus/src/test/kotlin/helpers.kt
index 57a1d2da..61aed19d 100644
--- a/nexus/src/test/kotlin/helpers.kt
+++ b/nexus/src/test/kotlin/helpers.kt
@@ -29,20 +29,20 @@ import kotlin.io.path.Path
fun conf(
conf: String = "test.conf",
- lambda: suspend (EbicsSetupConfig) -> Unit
+ lambda: suspend (NexusConfig) -> Unit
) = runBlocking {
val config = NEXUS_CONFIG_SOURCE.fromFile(Path("conf/$conf"))
- val ctx = EbicsSetupConfig(config)
+ val ctx = NexusConfig(config)
lambda(ctx)
}
fun setup(
conf: String = "test.conf",
- lambda: suspend (Database, EbicsSetupConfig) -> Unit
+ lambda: suspend (Database, NexusConfig) -> Unit
) = runBlocking {
val config = NEXUS_CONFIG_SOURCE.fromFile(Path("conf/$conf"))
val dbCfg = config.dbConfig()
- val ctx = EbicsSetupConfig(config)
+ val ctx = NexusConfig(config)
Database(dbCfg.dbConnStr).use {
it.conn { conn ->
resetDatabaseTables(conn, dbCfg, "libeufin-nexus")