Giter Site home page Giter Site logo

ex-openssl's Introduction

ExOpenssl

GitHub license Build Status Hex.pm Version InchCI

Installation

The package can be installed by adding ex_openssl to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_openssl, "~> 0.1.2"}
  ]
end

The docs can be found at https://hexdocs.pm/ex_openssl.

Supported OpenSSL Functions

  • X509
    • X509::stack_from_pem
  • PKey
    • PKey::private_key_from_pem
  • PKCS7
    • PKCS7::encrypt
    • PKCS7::decrypt
    • PKCS7::smime_read
    • PKCS7::smime_write

ex-openssl's People

Contributors

maennchen avatar scrogson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ex-openssl's Issues

Compilation error

$ mix deps.get
inch_ex is missing its version requirement, use ">= 0.0.0" if it should match any version
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  bunt 0.2.0
  credo 0.8.10
  dialyxir 0.5.1
  earmark 1.2.4
  ex_doc 0.18.1
  inch_ex 0.5.6
  poison 3.1.0
  rustler 0.10.1
* Getting rustler (Hex package)
* Getting ex_doc (Hex package)
* Getting inch_ex (Hex package)
* Getting credo (Hex package)
* Getting dialyxir (Hex package)
* Getting bunt (Hex package)
* Getting poison (Hex package)
* Getting earmark (Hex package)


$ iex -S mix
Erlang/OTP 21 [erts-10.1.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

==> bunt
Compiling 2 files (.ex)
Generated bunt app
==> dialyxir
Compiling 5 files (.ex)
Generated dialyxir app
==> earmark
Compiling 3 files (.erl)
/home/robert/.asdf/installs/erlang/19.1/lib/erlang/lib/parsetools-2.1.3/include/yeccpre.hrl:60: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
Compiling 24 files (.ex)
warning: variable "matches" is unused
  lib/earmark/scanner.ex:76

warning: variable "matches" is unused
  lib/earmark/scanner.ex:79

Generated earmark app
==> ex_doc
Compiling 15 files (.ex)
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
  lib/ex_doc/formatter/html.ex:291

warning: Kernel.Typespec.beam_callbacks/1 is deprecated. Use Code.Typespec.fetch_callbacks/1 instead
  lib/ex_doc/retriever.ex:494

warning: Kernel.Typespec.beam_specs/1 is deprecated. Use Code.Typespec.fetch_specs/1 instead
  lib/ex_doc/retriever.ex:481

warning: Kernel.Typespec.spec_to_ast/2 is deprecated. Use Code.Typespec.spec_to_quoted/2 instead
Found at 2 locations:
  lib/ex_doc/retriever.ex:246
  lib/ex_doc/retriever.ex:330

warning: Kernel.Typespec.type_to_ast/1 is deprecated. Use Code.Typespec.type_to_quoted/1 instead
  lib/ex_doc/retriever.ex:522

Generated ex_doc app
==> credo
Compiling 161 files (.ex)
warning: this clause cannot match because a previous clause at line 165 always matches
  lib/credo/cli/output/summary.ex:165

warning: module attribute @lint was set but never used
  lib/credo/check/find_lint_attributes.ex:23

Generated credo app
==> rustler
Compiling 2 files (.erl)
/usr/lib/erlang/lib/parsetools-2.1.2/include/yeccpre.hrl:60: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
Compiling 6 files (.ex)
warning: Kernel.to_char_list/1 is deprecated. Use Kernel.to_charlist/1 instead
  lib/rustler/toml_parser.ex:7

warning: Kernel.to_char_list/1 is deprecated. Use Kernel.to_charlist/1 instead
  lib/rustler/toml_parser.ex:7

Generated rustler app
==> ex_openssl
Compiling NIF crate :exopenssl (native/exopenssl)...
   Compiling erlang_nif-sys v0.6.3
   Compiling openssl-sys v0.9.21 (https://github.com/jshmrtn/rust-openssl.git?branch=feature/pkcs7#fbc5d4a3)
error: failed to run custom build command for `openssl-sys v0.9.21 (https://github.com/jshmrtn/rust-openssl.git?branch=feature/pkcs7#fbc5d4a3)`
process didn't exit successfully: `/development/ex-openssl/_build/dev/rustler_crates/exopenssl/debug/build/openssl-sys-4d163c72b1222885/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-E" "/development/ex-openssl/_build/dev/rustler_crates/exopenssl/debug/build/openssl-sys-3d93cc51e712d750/out/expando.c"
exit code: 0
cargo:rustc-cfg=osslconf="OPENSSL_NO_SSL3_METHOD"
cargo:conf=OPENSSL_NO_SSL3_METHOD

--- stderr
thread 'main' panicked at '

This crate is only compatible with OpenSSL 1.0.1, 1.0.2, and 1.1.0, or LibreSSL
2.5 and 2.6.0, but a different version of OpenSSL was found. The build is now
aborting due to this version mismatch.

', /development/.cargo/git/checkouts/rust-openssl-9240620e21fb14b2/fbc5d4a/openssl-sys/build.rs:486:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `erlang_nif-sys v0.6.3`
process didn't exit successfully: `/development/ex-openssl/_build/dev/rustler_crates/exopenssl/debug/build/erlang_nif-sys-9bda4bd08603e1fd/build-script-build` (exit code: 101)
--- stdout
Unsupported Erlang version.

Is the erlang_nif-sys version up to date in the Cargo.toml?
Does 'cargo update' fix it?
If not please report at https://github.com/goertzenator/erlang_nif-sys.

--- stderr
thread 'main' panicked at 'gen_api.erl encountered an error.', /development/.cargo/registry/src/github.com-1ecc6299db9ec823/erlang_nif-sys-0.6.3/build.rs:28:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

** (RuntimeError) Rust NIF compile error (rustc exit code 101)
    lib/mix/tasks/compile.rustler.ex:62: Mix.Tasks.Compile.Rustler.compile_crate/1
    (elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
    lib/mix/tasks/compile.rustler.ex:15: Mix.Tasks.Compile.Rustler.run/1
    (mix) lib/mix/task.ex:316: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.all.ex:68: Mix.Tasks.Compile.All.run_compiler/2
    (mix) lib/mix/tasks/compile.all.ex:52: Mix.Tasks.Compile.All.do_compile/4
    (mix) lib/mix/tasks/compile.all.ex:23: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
    (mix) lib/mix/tasks/compile.all.ex:39: Mix.Tasks.Compile.All.with_logger_app/1

SegFault on MacOS

Bountysource

There is a SegFault on Mac OS X 10.13. It seems to only happen on macos and not on Linux.

$ USE_LLDB=1 mix test
(lldb) command source -s 0 '/tmp/rust-lldb-commands.c8UduS'
Executing commands in '/tmp/rust-lldb-commands.c8UduS'.
(lldb) command script import "/usr/local/Cellar/rust/1.22.1/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec"
Current executable set to '/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec' (x86_64).
(lldb) settings set -- target.run-args  "--args" "/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec" "-pa" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/eex/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/elixir/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/ex_unit/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/iex/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/logger/ebin" "/usr/local/Cellar/elixir/1.5.2/bin/../lib/mix/ebin" "-elixir" "ansi_enabled" "true" "-noshell" "-s" "elixir" "start_cli" "-extra" "/usr/local/bin/mix" "test"
(lldb) run
Process 82631 launched: '/usr/local/Cellar/erlang/20.1.5/lib/erlang/erts-9.1.4/bin/erlexec' (x86_64)
Process 82631 stopped
* thread #2, stop reason = exec
    frame #0: 0x000000001035a19c dyld`_dyld_start
dyld`_dyld_start:
->  0x1035a19c <+0>: popq   %rdi
    0x1035a19d <+1>: pushq  $0x0
    0x1035a19f <+3>: movq   %rsp, %rbp
    0x1035a1a2 <+6>: andq   $-0x10, %rsp
Target 0: (beam.smp) stopped.
(lldb) continue
Process 82631 resuming
Compiling NIF crate :exopenssl (native/exopenssl)...
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Process 82631 stopped
* thread #22, name = '8_scheduler', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (beam.smp) stopped.
(lldb) bt
* thread #22, name = '8_scheduler', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x0000000018e7b40d libcrypto.1.1.dylib`EVP_CipherInit_ex + 702
    frame #2: 0x0000000018ea0e69 libcrypto.1.1.dylib`PKCS7_dataInit + 717
    frame #3: 0x0000000018ea085d libcrypto.1.1.dylib`pk7_cb + 90
    frame #4: 0x0000000018dc644b libcrypto.1.1.dylib`BIO_new_NDEF + 209
    frame #5: 0x0000000018dc387e libcrypto.1.1.dylib`i2d_ASN1_bio_stream + 62
    frame #6: 0x0000000018dc3c3c libcrypto.1.1.dylib`B64_write_ASN1 + 84
    frame #7: 0x0000000018dc407a libcrypto.1.1.dylib`SMIME_write_ASN1 + 995
    frame #8: 0x0000000018ea3bdd libcrypto.1.1.dylib`SMIME_write_PKCS7 + 96
    frame #9: 0x0000000018a346d0 libexopenssl.so`openssl::crypto::pkcs7::pk7_smime::PKCS7::smime_write::h8cdfd386f1cfc883 + 784
    frame #10: 0x00000000189d992f libexopenssl.so`exopenssl::crypto::pkcs7::smime::write::h19eb48c76451c5b6 + 2431
    frame #11: 0x00000000189ed6db libexopenssl.so`rustler::codegen_runtime::handle_nif_call::_$u7b$$u7b$closure$u7d$$u7d$::h79244b291af935f2 + 171
    frame #12: 0x00000000189e993d libexopenssl.so`std::panicking::try::do_call::h10e475cd929785d0 + 93
    frame #13: 0x0000000018ac37fd libexopenssl.so`__rust_maybe_catch_panic + 29
    frame #14: 0x00000000189e983e libexopenssl.so`std::panicking::try::hab939d6c0c62c184 + 190
    frame #15: 0x00000000189e61b2 libexopenssl.so`std::panic::catch_unwind::ha9388196fd28dd86 + 98
    frame #16: 0x00000000189ed3b1 libexopenssl.so`rustler::codegen_runtime::handle_nif_call::h76c8de0c6446e920 + 337
    frame #17: 0x00000000189df986 libexopenssl.so`exopenssl::nif_init::FUN_ENTRIES::nif_func::h60cef4053a7de575 + 86
    frame #18: 0x0000000010008dbb beam.smp`process_main + 26706
    frame #19: 0x000000001008f14d beam.smp`sched_thread_func + 362
    frame #20: 0x00000000101f4179 beam.smp`thr_wrapper + 159
    frame #21: 0x00007fff6b45f6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #22: 0x00007fff6b45f56d libsystem_pthread.dylib`_pthread_start + 377
    frame #23: 0x00007fff6b45ec5d libsystem_pthread.dylib`thread_start + 13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.