-
Notifications
You must be signed in to change notification settings - Fork 922
Added new ASN X509 API: wc_GetSubjectPubKeyInfoDerFromCert
#8758
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new ASN API function to export the full X509 public key including the Subject Public Key Info (SPKI) section. Key changes include:
- Declaring the new function wc_ExportX509PubKeyWithSpki in asn_public.h.
- Implementing the new API in asn.c with proper error checking and SPKI extraction.
- Adding corresponding tests in tests/api.c to verify the functionality with RSA and ECC certificates.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolfssl/wolfcrypt/asn_public.h | Added the function declaration for wc_ExportX509PubKeyWithSpki. |
| wolfcrypt/src/asn.c | Implemented the new API function with SPKI extraction logic. |
| tests/api.c | Introduced tests for the new API function covering valid and error cases. |
Comments suppressed due to low confidence (1)
wolfssl/wolfcrypt/asn_public.h:882
- [nitpick] The parameter name 'cert' in the header is inconsistent with 'certDer' used in the implementation; consider using consistent naming across header and source for clarity.
WOLFSSL_API int wc_ExportX509PubKeyWithSpki(const byte* cert, word32 certSz,
b1d2b53 to
95690ee
Compare
95690ee to
79f214f
Compare
|
I'm not sure if its me thats weird, but shouldn't it be |
|
@anhu figured it was returning the public key portion of the cert WITH SPKI as opposed to our other version of it that returns just the raw stuff. But you are probably right here |
|
Jenkins retest this please |
|
Accepting peanut gallery comments on an appropriate name for the function, Anthony makes a good point. If a reviewer has an opinion on what makes more sense please LMK |
|
Jenkins retest this please |
wc_GetSubjectPubKeyInfoDerFromCert
|
Jenkins retest this please |
Description
Adds a new ASN API function to export the FULL public key from an X509, including subject public key info (SPKI). Currently we have
wc_GetPubKeyDerFromCert()but this is only the raw public key DER fields and does not include SPKI headers.Need something like this for wolfHSM cert management.
Testing
Added test to api.c
Checklist