Cant to transform private.key to .pem file with X509 library

Hi everyone!! iam getting the next error when i try to use X509.PrivateKey.to_pem

iex(174)> X509.PrivateKey.to_pem(priv, [password: pass])
** (FunctionClauseError) no function clause matching in X509.PrivateKey.pem_entry_encode/2

The following arguments were given to X509.PrivateKey.pem_entry_encode/2:

    # 1
    <<48, 130, 5, 14, 48, 64, 6, 9, 42, 134, 72, 134, 247, 13, 1, 5, 13, 48, 51, 48,
      27, 6, 9, 42, 134, 72, 134, 247, 13, 1, 5, 12, 48, 14, 4, 8, 2, 1, 0, 2, 130,
      1, 1, 0, 2, 2, 8, 0, 48, 20, ...>>

    # 2
    '12345678a'

Attempted function clauses (showing 7 out of 7):

    defp pem_entry_encode({:RSAPrivateKey, _, _, _, _, _, _, _, _, _, _} = rsa_private_key, nil)
    defp pem_entry_encode({:ECPrivateKey, _, _, _, _, _} = ec_private_key, nil)
    defp pem_entry_encode({:PrivateKeyInfo, _, _, _, _} = private_key_info, nil)
    defp pem_entry_encode(private_key, password) when is_binary(password)
    defp pem_entry_encode({:RSAPrivateKey, _, _, _, _, _, _, _, _, _, _} = rsa_private_key, password)
    defp pem_entry_encode({:ECPrivateKey, _, _, _, _, _} = ec_private_key, password)
    defp pem_entry_encode({:PrivateKeyInfo, _, _, _, _} = private_key_info, password)

(x509 0.8.5) lib/x509/private_key.ex:281: X509.PrivateKey.pem_entry_encode/2
(x509 0.8.5) lib/x509/private_key.ex:158: X509.PrivateKey.to_pem/2
iex:174: (file)

Try passing in a binary (double quotes) as the second arg, seems like you are using a list (single quotes).

Check this out:

iex(1)> i '12345678a'                  
Term
  '12345678a'
Data type
  List
Description
  This is a list of integers that is printed as a sequence of characters
  delimited by single quotes because all the integers in it represent printable
  ASCII characters. Conventionally, a list of Unicode code points is known as a
  charlist and a list of ASCII characters is a subset of it.
Raw representation
  [49, 50, 51, 52, 53, 54, 55, 56, 97]
Reference modules
  List
Implemented protocols
  Collectable, Enumerable, IEx.Info, Inspect, List.Chars, String.Chars
iex(2)> i List.to_string('12345678a')
Term
  "12345678a"
Data type
  BitString
Byte size
  9
Description
  This is a string: a UTF-8 encoded binary. It's printed surrounded by
  "double quotes" because all UTF-8 encoded code points in it are printable.
Raw representation
  <<49, 50, 51, 52, 53, 54, 55, 56, 97>>
Reference modules
  String, :binary
Implemented protocols
  Collectable, IEx.Info, Inspect, List.Chars, String.Chars
iex(3)> 

Yes password is a String , i call de function X509.PrivateKey.to_pem(priv, [password: pass]) Where pass is “12345678a” , but in the internal stacktrace is transformed to bitstring

This function expects the private key as an Erlang (public_key) record as the first argument, but you appear to be passing in a DER binary.