ruby / ruby/openssl

access to raw public key, or keyid

Open
#163 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.