Updated Ragger tests to use the new private CAL key

This commit is contained in:
Alexandre Paillier
2022-11-16 15:16:44 +01:00
parent bbe1723b25
commit 2300bb9d00
3 changed files with 21 additions and 11 deletions

18
tests/ragger/cal/cal.py Normal file
View File

@@ -0,0 +1,18 @@
import os
import hashlib
from ecdsa.util import sigencode_der
from ecdsa import SigningKey
_key: SigningKey = None
def _init_key():
global _key
with open(os.path.dirname(__file__) + "/key.pem") as pem_file:
_key = SigningKey.from_pem(pem_file.read(), hashlib.sha256)
assert _key != None
def sign(data: bytes) -> bytes:
global _key
if not _key:
_init_key()
return _key.sign_deterministic(data, sigencode=sigencode_der)