Skip to content

change signature of signed_by to accept &impl AsRef<CertificateParams> issuer#307

Merged
djc merged 1 commit into
rustls:mainfrom
audunhalland:sign-using-params
Jan 4, 2025
Merged

change signature of signed_by to accept &impl AsRef<CertificateParams> issuer#307
djc merged 1 commit into
rustls:mainfrom
audunhalland:sign-using-params

Conversation

@audunhalland

Copy link
Copy Markdown
Contributor

I had the issue that I wanted to use an issuer that was a CertificateParams, not a Certificate (because CertificateParams can be deserialized from file, but Certificate can not). The best solution I've found is to change the signature to accept &impl AsRef<CertificateParams>, and then implement that AsRef for both Certificate and CertificateParams.

I think this is also a backwards-compatible change, but I'm not 100% sure.

Comment thread rcgen/src/certificate.rs
@djc

djc commented Jan 4, 2025

Copy link
Copy Markdown
Member

This seems like a nice improvement!

@cpu cpu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@djc djc added this pull request to the merge queue Jan 4, 2025
Merged via the queue into rustls:main with commit b2a851f Jan 4, 2025
@est31

est31 commented Jan 4, 2025

Copy link
Copy Markdown
Member

The issue with AsRef tricks is that it isn't immediately obvious what types implement AsRef<CertificateParams>. It would be nice to point it out in the docs that both Certificate and CertificateParams implement it.

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

Successfully merging this pull request may close these issues.

4 participants