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

Add Display implementation to X509NameRef #2238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

overhacked
Copy link

Add a convenient way of displaying the OIDs of a certificate without writing downstream code to iterate over and convert them individually. Also makes for easier interop with other OpenSSL-based projects (including openssl CLI), because the output should match what those tools output if the library version is the same (or similar).

Adapted & simplified from #1688, based on @davidben's #1688 (comment). Removes access to all the wonky flag possibilities in X509_NAME_print_ex(3). Internally, still calls X509_NAME_print_ex(3) with RFC2253 flags and disable UTF-8 escaping so the result is a UTF-8-encoded string.

Test included ensures that:

  • Printing the name of a certificate with Unicode characters, emoji in this case, functions.
  • Formatting a name with ASCII-only OID values results in the expected RFC2253 output.

Internally, call `X509_NAME_print_ex(3)` with RFC2253 flags and disable
UTF-8 escaping so the result is a UTF-8-encoded string.

Signed-off-by: Ross Williams <[email protected]>
@overhacked overhacked force-pushed the overhacked/x509nameref_display branch from c2d4841 to 340e3e3 Compare May 13, 2024 23:33
@overhacked
Copy link
Author

Failure in CI, saying that consts from bssl_sys are the wrong type, even though they are correctly typed in bssl_sys/src/lib.rs. This builds successfully with --features bindgen,unstable_boringssl on my machine with the same commit hash for boringssl that the CI is using (2db0eb3f). I'm happy to troubleshoot, but I'm not sure where to start figuring out how the CI environment is different.

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.

1 participant