Skip to content

x509-cert: add DirectoryString::BmpString #1794

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dishmaker
Copy link
Contributor

@dishmaker dishmaker commented May 2, 2025

fn as_ref(&self) -> &str {
match self {
Self::PrintableString(s) => s.as_ref(),
Self::TeletexString(s) => s.as_ref(),
Self::Utf8String(s) => s.as_ref(),
// TODO(dishmaker): BMPString as ref
Self::BmpString(_s) => "",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as_ref can't be deprecated

Copy link
Member

Choose a reason for hiding this comment

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

Could maybe use Cow<str> here, though that would need a different method name.

Another option is to transcode while decoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it was used before as

<_ as AsRef<str>>::as_ref(&value)

x509-cert: use alloc instead of std

x509-cert: apply clippy Cow<'_, str>

x509-cert: fix test decode_cert_bmpstring
@dishmaker dishmaker force-pushed the dishmaker/x509_cert_add_bmpstring branch from 25f4c88 to 3c1a63c Compare May 2, 2025 21:46
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.

x509-cert: BMPString support for DirectoryString
2 participants