bug, in VerifyingKey raise UnexpectedDER("wanted type 'object' (0x06), got 0x%02x" % n)
marti1125 opened this issue · 2 comments
marti1125 commented
Steps
private key openssl ecparam -name secp384r1 -genkey -out pri_key.pem
public key openssl req -new -x509 -days 356 -key pri_key.pem -out certificate.pem -subj "/C=MX/ST=CDMX/L=MH/O=CDC/CN=CDC"
with open("/etc/certs/certificate.pem", "r") as public_key:
vk = VerifyingKey.from_pem(public_key.read())
with open("/etc/certs/pri_key.pem", "r") as p_key:
sk = SigningKey.from_pem(p_key.read(), hashlib.sha384)
d = b"message"
signature = sk.sign_deterministic(d, sigencode=sigencode_der)
getting error when try to open certificate.pem
tomato42 commented
It's not a bug, it's missing functionality. Loading public keys from X.509 certificates is not supported.
Duplicate of #119
marti1125 commented
Thank you for your replay!