JuliaWeb / JuliaWeb/OpenSSL.jl

X509 to DER encoding

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
19
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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.

```julia
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.