From 13c106e7b8d925f6c3dd1659813b2b705e16737b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 29 Sep 2021 14:10:55 +0300 Subject: [PATCH] Export curve name for WebCrypto --- pinecrypt/server/api/bootstrap.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pinecrypt/server/api/bootstrap.py b/pinecrypt/server/api/bootstrap.py index 77d109a..7678232 100644 --- a/pinecrypt/server/api/bootstrap.py +++ b/pinecrypt/server/api/bootstrap.py @@ -18,6 +18,12 @@ HASH_ALGO_MAPPING = { "sha512": "SHA-512", } +CURVE_NAME_MAPPING = { + "secp256r1": "P-256", + "secp384r1": "P-384", + "secp521r1": "P-521", +} + class BootstrapResource(object): @serialize def on_get(self, req, resp): @@ -44,6 +50,7 @@ class BootstrapResource(object): webcrypto=dict( hash_algorithm=HASH_ALGO_MAPPING[authority.certificate.hash_algo], signature_algorithm=SIGNATURE_ALGO_MAPPING[authority.certificate.signature_algo], + curve=CURVE_NAME_MAPPING.get(const.CURVE_NAME), ), certificate=dict( key_size=const.KEY_SIZE,