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

key fingerprint #164

Open
shawnl opened this issue Aug 1, 2018 · 6 comments
Open

key fingerprint #164

shawnl opened this issue Aug 1, 2018 · 6 comments

Comments

@shawnl
Copy link

shawnl commented Aug 1, 2018

I am not sure what I can do to get the public key with minicrypto/picotls, so that I can hash it (and hash it properly, I have no idea), so I can build ssh-like authentication.

@kazuho
Copy link
Member

kazuho commented Aug 1, 2018

minicrypto does not provide an interface to deal with the internals of a certificate (e.g. public key), though you might be able to use the existing code that extracts the private key from a PEM file.

However, you can verify the certificate rather than the public key; i.e. check that checksum of the end certificate provided by the server is equal to the value of a certificate that have been verified at a prior moment.

I believe that you can implement that by writing your own ptls_verify_certificate_t callback.

@shawnl
Copy link
Author

shawnl commented Aug 1, 2018

I believe void **verify_data of verify_certificate callback refers to the public key

@kazuho
Copy link
Member

kazuho commented Aug 2, 2018

That depends on how you implement the callback.

But yes, we need to do two things:
*extract the public key of the certificate and validate the CertificateVerify message using the public key, to make sure that the owner of the certificate is the peer

  • verify the certificate, to make sure that the certificate is legitimate

Regardless of how we would validate the legitimacy of certificate (e.g. track the chain of trust to the root certificate, check the hash of the server certificate), we are required to extract the public key of the certificate.

Unfortunately, we do not have the function. Though I think you can implement one using the ASN.1 decoding functions found in pembase64.c.

The other other would be to add support for Raw Public Key instead of certificate (see RFC 7250 and TLS 1.3 draft section 4.4.2).

But either option requires some development on the picotls side. I am happy to review a PR that implements either of them.

@shawnl
Copy link
Author

shawnl commented Aug 2, 2018

It appears picotls would be the first to support RFC 7250 Raw Public Key if it was implemented.

@shawnl
Copy link
Author

shawnl commented Aug 2, 2018

I don't see any ASN.1 in pembase64.c, just base64 stuff.

@kazuho
Copy link
Member

kazuho commented Aug 2, 2018

@shawnl My bad. The code that deals with private keys is in minicrypto-pem.c.

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

No branches or pull requests

2 participants