【问题标题】:Use crypto in erlang escript在 erlang escript 中使用加密
【发布时间】:2015-10-07 04:23:52
【问题描述】:

我有一个 erlang 项目,我将为它生成一个独立的 erlang escript,为此我使用了 rebar escriptize,将所有依赖项添加到我的 rebar.conf 和如您所见,还有其他一些选项

{erl_opts, [{parse_transform, lager_transform}]}.
{lib_dirs,["deps"]}.

{deps, [
{'lager', ".*", {
  git, "git://github.com/basho/lager.git", {tag, "2.0.0"}}
},
{'cowboy', ".*", {
    git, "git://github.com/ninenines/cowboy.git", {tag, "2.0.0-pre.1"}}
},
{'jsx', ".*", {
    git, "git://github.com/talentdeficit/jsx.git", {tag, "v2.0.4"}}
}
]}.


{escript_emu_args, "%%! -smp auto\n"}.
{escript_emu_args, "%%! -pz ../dir-of-some-beams\n"}.
{escript_name, "multiscreen_ws_app"}.
{escript_incl_apps,   [sasl,stdlib,kernel,ranch,crypto,cowlib,cowboy,asn1,public_key,ssl,jsx,compiler    ,syntax_tools,lager,goldrush]}.

当然,我在主模块中创建了一个主方法来启动脚本。当我使用 escript multiscreen_ws_app 命令运行生成脚本时,我看到我的程序输出很好,但是当我收到我的第一个 websocket 包并尝试解密它 BAM 时,它只是不起作用,我得到消息:

17:03:30.222 [error] Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library c:/Users/alessandro.herculano/Music/mul
tiscreen_ws_app/crypto/priv/lib/crypto: 'Couldn't load the specified method
ecificado.'"
OpenSSL might not be installed on this system.

奇怪的事实是它试图在我的脚本文件中搜索,就像它是一个文件夹一样! c:/Users/alessandro.herculano/Music/multiscreen_ws_app/crypto/priv/lib/crypto 但 multiscreen_ws_app 是我的脚本文件!我该怎么做才能让我的脚本在另一个预定义的位置搜索它?

-------一些可能很重要的点----

  • 我在 Windows 8 x64 机器上运行它
  • 当我不使用脚本运行它时,我的应用程序运行良好
  • 我已经尝试在我的顶部使用 code:add_pathz main 指示加密文件夹,但它也不起作用。

【问题讨论】:

    标签: cryptography erlang escript


    【解决方案1】:

    刚刚找到解决方案,我的错,只需从 escript_incl_apps 列表中删除“crypto”即可解决问题。

    【讨论】:

      猜你喜欢
      • 2011-09-01
      • 2020-09-12
      • 2017-05-30
      • 1970-01-01
      • 2016-11-30
      • 2011-02-24
      • 1970-01-01
      • 2012-11-29
      • 1970-01-01
      相关资源
      最近更新 更多