access to raw public key, or keyid
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 276
- Forks
- 200
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 7
Description
RFC5280, section 4.2.1.2 defines keyid as the SHA1 of the subjectPublicKey encoding.
OpenSSL::PKey::EC's to_text
reveals the public key info via an OpenSSL method that produces text. This is the input that we need for the SHA1, and I guess I could decode the text back to binary if I had to, but this seems really wrong....
While there is some code in openssl/crypto/x509v3/v3_skey.c that calculates what I want, it's buried inside an extension definition, and can't (AFAIK) be used directly.
I can get what I want via:
a1 = OpenSSL::ASN1.decode(pubkey.to_der)
a1.value[1].value
but that just seems wrong. Is there another way to pull the encoded public key out?
Should getting this keyid be ruby or C code?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review OpenSSL::PKey::EC#to_text, #to_der, and the OpenSSL::ASN1.decode approach described in the issue, then inspect openssl/crypto/x509v3/v3_skey.c for the existing key identifier calculation. Determine whether a Ruby or C API should expose the encoded public key or keyid, and confirm that the result matches RFC 5280 section 4.2.1.2 without converting text back to binary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, ruby
- Domain
- cryptography
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100