Export curve name for WebCrypto

This commit is contained in:
Lauri Võsandi 2021-09-29 14:10:55 +03:00
parent 073e4274e6
commit 13c106e7b8
1 changed files with 7 additions and 0 deletions

View File

@ -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,