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

X509 to DER encoding #31

Open
Screenhandsaw opened this issue Nov 16, 2023 · 0 comments
Open

X509 to DER encoding #31

Screenhandsaw opened this issue Nov 16, 2023 · 0 comments

Comments

@Screenhandsaw
Copy link

Hello,

and thank you for the work on this library so far.

I'm having some issues when trying to extract the DER encoding from a X509Certificate. Using this library together with OpenSSL_jll we have access to i2d_x509 which does this conversion. However, it produces a segmentation fault.

using OpenSSL, OpenSSL_jll

function der(cert::X509Certificate)
   buf = Vector{UInt8}(undef, 2048)
   len = @ccall libssl.i2d_X509(cert::X509Certificate, buf::Ptr{UInt8})::Cint
   @info len
end

# ------------ output
# Segmentation fault: 11 in expression starting at REPL[10]:1
# ASN1_put_object at /lib/libcrypto.3.dylib (unknown line)
# ASN1_item_ex_i2d at /lib/libcrypto.3.dylib (unknown line)
# Allocations: 660735 (Pool: 660175; Big: 560); GC: 1

As noted in other issues, it seems I/O is somewhat problematic currently. But maybe I'm doing something wrong (I also tried i2d_x509_bio with the BIO struct provided by this library, but it also produces errors like this).

Thank you for any help.

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

1 participant