Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug, in VerifyingKey raise UnexpectedDER("wanted type 'object' (0x06), got 0x%02x" % n) #311

Closed
marti1125 opened this issue Feb 15, 2023 · 2 comments

Comments

@marti1125
Copy link

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
Copy link
Member

It's not a bug, it's missing functionality. Loading public keys from X.509 certificates is not supported.
Duplicate of #119

@tomato42 tomato42 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
@marti1125
Copy link
Author

Thank you for your replay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants