Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol.UndefinedError with Elixir 1.14 #16

Open
ninoseki opened this issue Apr 15, 2023 · 1 comment
Open

Protocol.UndefinedError with Elixir 1.14 #16

ninoseki opened this issue Apr 15, 2023 · 1 comment

Comments

@ninoseki
Copy link
Contributor

I got the following errors when I try to use EasySSL with Elixir 1.14.
(Sorry I'm an Elixir newbie and I cannot guess a root cause but let me report)

$ elixir  --version                                                                                                                                                                         11:38:54
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

Elixir 1.14.4 (compiled with Erlang/OTP 23)
$ mix test                                                                                                                                                                                  11:38:39
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:3

Compiling 1 file (.ex)


  1) test parses signature algorithm correctly (EasySSLTest)
     test/easy_ssl_test.exs:112
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 42, 48, 40, 160, 38, 160, 36, 134, 34, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 46, 103, 111, 100, 97, 100, 100, 121, 46, 99, 111, 109, 47, 103, 100, 115, 49, 45, 57, 48, 46, 99, 114, 108>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: cert = File.read!(@pem_cert_dir <> "acaline.com.crt") |> EasySSL.parse_pem()
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:113: (test)

..

  2) test parses all certifiates in @pem_cert_dir directory (EasySSLTest)
     test/easy_ssl_test.exs:34
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 42, 48, 40, 160, 38, 160, 36, 134, 34, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 46, 103, 111, 100, 97, 100, 100, 121, 46, 99, 111, 109, 47, 103, 100, 115, 49, 45, 57, 48, 46, 99, 114, 108>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: |> Enum.each(fn cert_filename ->
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:38: anonymous fn/1 in EasySSLTest."test parses all certifiates in @pem_cert_dir directory"/1
       (elixir 1.14.4) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
       test/easy_ssl_test.exs:36: (test)

.

  3) test parses subject and issuer correctly (EasySSLTest)
     test/easy_ssl_test.exs:103
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 90, 48, 43, 160, 41, 160, 39, 134, 37, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 51, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 47, 101, 118, 99, 97, 49, 45, 103, 50, 46, 99, 114, 108, 48, 43, 160, ...>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: cert = File.read!(@pem_cert_dir <> "github.com.crt") |> EasySSL.parse_pem()
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:104: (test)



  4) test parses validity dates correctly (EasySSLTest)
     test/easy_ssl_test.exs:89
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 90, 48, 43, 160, 41, 160, 39, 134, 37, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 51, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 47, 101, 118, 99, 97, 49, 45, 103, 50, 46, 99, 114, 108, 48, 43, 160, ...>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: cert = File.read!(@pem_cert_dir <> "github.com.crt") |> EasySSL.parse_pem()
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:90: (test)



  5) test parses all certifiates in @der_cert_dir directory (EasySSLTest)
     test/easy_ssl_test.exs:21
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 60, 48, 58, 160, 56, 160, 54, 134, 52, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 46, 103, 108, 111, 98, 97, 108, 115, 105, 103, 110, 46, 99, 111, 109, 47, 103, 115, 47, 103, 115, 111, 114, 103, 97, 110, 105, 122, 97, 116, ...>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: |> Enum.each(fn cert_filename ->
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:25: anonymous fn/1 in EasySSLTest."test parses all certifiates in @der_cert_dir directory"/1
       (elixir 1.14.4) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
       test/easy_ssl_test.exs:23: (test)



  6) test parses and adds all domains to the top level leaf node (EasySSLTest)
     test/easy_ssl_test.exs:59
     ** (Protocol.UndefinedError) protocol Enumerable not implemented for <<48, 57, 48, 55, 160, 53, 160, 51, 134, 49, 104, 116, 116, 112, 58, 47, 47, 69, 86, 83, 101, 99, 117, 114, 101, 45, 99, 114, 108, 46, 118, 101, 114, 105, 115, 105, 103, 110, 46, 99, 111, 109, 47, 69, 86, 83, 101, 99, 117, 114, ...>> of type BitString. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
     code: |> EasySSL.parse_der()
     stacktrace:
       (elixir 1.14.4) lib/enum.ex:1: Enumerable.impl_for!/1
       (elixir 1.14.4) lib/enum.ex:166: Enumerable.reduce/3
       (elixir 1.14.4) lib/enum.ex:4307: Enum.reduce/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:523: anonymous fn/2 in EasySSL.parse_extensions/1
       (elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (easy_ssl 1.3.0) lib/easy_ssl.ex:86: EasySSL.parse_der/2
       test/easy_ssl_test.exs:63: (test)


Finished in 0.08 seconds (0.00s async, 0.08s sync)
9 tests, 6 failures
@andrewtimberlake
Copy link

I believe it’s a problem with OTP 25, not Elixir 1.14
Previous versions of OTP automatically decoded certain extension points which OTP 25 apparently doesn’t
See voltone/x509#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants