Skip to content

X509 to DER encoding #31

@Screenhandsaw

Description

@Screenhandsaw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions