SC-HSM returns the result with a 0x04 prepended. This comes from OpenSC but it is not clear the exact reason. 0x04 is usually for encoding uncompressed EC points but in that case it does not seem to make sense.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-03-18 18:40:27 +01:00
parent 755570e01a
commit 99f1620e7d
2 changed files with 7 additions and 4 deletions

View File

@@ -411,7 +411,7 @@ class Device:
def exchange(self, keyid, pubkey):
resp = self.send(cla=0x80, command=0x62, p1=keyid, p2=Algorithm.ALGO_EC_ECDH.value, data=pubkey.public_bytes(Encoding.X962, PublicFormat.UncompressedPoint))
return resp
return resp[1:]
def parse_cvc(self, data):
car = CVC().decode(data).car()