diff options
author | Badlop <badlop@process-one.net> | 2010-07-09 20:02:29 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2010-07-12 13:57:07 +0200 |
commit | 12e00c57f92e03df5b574b97971af8c8013712ff (patch) | |
tree | 88525006352a204e3c0edc5f2527a1f49c60f59b /src/tls/tls.erl | |
parent | Mention missing modules in the overview table (diff) |
When using OTP R14, use public_key library instead of old ssl (EJAB-953)
Diffstat (limited to '')
-rw-r--r-- | src/tls/tls.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tls/tls.erl b/src/tls/tls.erl index 9aee54cf..9c921b36 100644 --- a/src/tls/tls.erl +++ b/src/tls/tls.erl @@ -61,6 +61,13 @@ -define(GET_VERIFY_RESULT, 8). -define(VERIFY_NONE, 16#10000). +-ifdef(SSL40). +-define(CERT_DECODE, {public_key, pkix_decode_cert, plain}). +-else. +-define(CERT_DECODE, {ssl_pkix, decode_cert, [pkix]}). +-endif. + + -record(tlssock, {tcpsock, tlsport}). start() -> @@ -232,7 +239,8 @@ close(#tlssock{tcpsock = TCPSocket, tlsport = Port}) -> get_peer_certificate(#tlssock{tlsport = Port}) -> case port_control(Port, ?GET_PEER_CERTIFICATE, []) of <<0, BCert/binary>> -> - case catch ssl_pkix:decode_cert(BCert, [pkix]) of + {CertMod, CertFun, CertSecondArg} = ?CERT_DECODE, + case catch apply(CertMod, CertFun, [BCert, CertSecondArg]) of {ok, Cert} -> {ok, Cert}; _ -> |