libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 48a8a49fae84624f32f4ca294af8774643bbdf9c
parent 786b70a1327066bc5670aa6ccc0c5f4f2ec6ed1c
Author: ms <ms@taler.net>
Date:   Fri, 16 Jul 2021 17:05:13 +0200

key-rotation endpoint (testing)

Diffstat:
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -652,6 +652,31 @@ fun serverMain(dbName: String, port: Int) { call.respond(ret) return@get } + post("/admin/ebics/hosts/{hostID}/rotate-keys") { + val hostID: String = call.parameters["hostID"] ?: throw SandboxError( + HttpStatusCode.BadRequest, "host ID missing in URL" + ) + transaction { + val host = EbicsHostEntity.find { + EbicsHostsTable.hostID eq hostID + }.firstOrNull() ?: throw SandboxError( + HttpStatusCode.NotFound, "Host $hostID not found" + ) + val pairA = CryptoUtil.generateRsaKeyPair(2048) + val pairB = CryptoUtil.generateRsaKeyPair(2048) + val pairC = CryptoUtil.generateRsaKeyPair(2048) + host.authenticationPrivateKey = ExposedBlob(pairA.private.encoded) + host.encryptionPrivateKey = ExposedBlob(pairB.private.encoded) + host.signaturePrivateKey = ExposedBlob(pairC.private.encoded) + } + call.respondText( + "Keys of '${hostID}' rotated.", + ContentType.Text.Plain, + HttpStatusCode.OK + ) + return@post + } + /** * Creates a new EBICS host. */