OpenSSL.jl/src/OpenSSL.jl

50 lines
906 B
Julia

module OpenSSL
export ca_chain!, close
const libssl = "/gnu/store/hcxpkksmbql6s4al8yy2myr25kh4cic0-openssl-1.1.1g/lib/libssl.so"
include("consts.jl")
include("evp_md.jl")
include("types.jl")
export SSLContext, SSLClient, CAChain
include("methods.jl")
include("bio.jl")
include("context.jl")
include("ssl.jl")
include("certs.jl")
include("flow_control.jl")
include("errors.jl")
import Base.read
function read(client::SSLClient)
buf = Vector{UInt8}(undef, 64)
n = ssl_read!(client, buf)
return (n, buf)
end
import Base.write
function write(client::SSLClient, data)
send_unencrypted_bytes(client, data)
do_encrypt(client)
do_sock_write(client)
end
write(c::SSLClient, s::String) = write(c, Vector{UInt8}(s))
import Base.close
function close(client::SSLClient)
closed = do_ssl_shutdown(client)
@show closed
close(client.sock)
free(client)
end
end # module