[erlang-questions] Erlang SSL: how to connect to server, having password-protected key and cer?

Max Lapshin <>
Sun Jul 29 13:34:54 CEST 2012


Hi.

My service provider asked me to generate CSR for SSL connection.
I've generated SSL key (RSA PRIVATE KEY) and CSR for it.

Provider sent me cer file (Signature Algorithm: sha1WithRSAEncryption
written inside it).
It seems that I could convert this cer to pem with:

openssl x508 -outform pem -in client.cer -out client.pem

How can I connect for provider with these things?


Host="..."
Port=2000
PrivateKey="client.key"
PrivatePassword=".."
ClientPem="client.pem"

What should I do?


  Options = [
    {certfile, ClientPem}
    ,{keyfile, PrivateKey}
    ,{password, PrivatePassword}
    ,binary
    ,{active,false}
  ],
  {ok, SSL} = ssl:connect(Host, Port, Options),


This code gives me SSL socket, which is closed right after first sent
data packet.



More information about the erlang-questions mailing list