[erlang-bugs] SSL Client Certificate Request types with EC certificates

Peter Cooper pcooper@REDACTED
Fri Jul 11 18:21:02 CEST 2014


> -----Original Message-----
> From: erlang-bugs-bounces@REDACTED [mailto:erlang-bugs-
> bounces@REDACTED] On Behalf Of Peter Cooper
> Sent: Friday, July 11, 2014 10:42 AM
> To: 'erlang-bugs@REDACTED'
> Subject: [erlang-bugs] SSL Client Certificate Request types with EC
> certificates
> 
> It's entirely possible (even likely) I'm misunderstanding something
> about how these SSL ciphers are supposed to work, but the behavior I'm
> seeing looks like an Erlang issue to me. I'm trying to use RabbitMQ on
> Erlang 17.1 on 64-bit Windows 7, requiring a connection using SSL with
> a client certificate. All the certificates are using elliptic curve
> (secp256k1) keys. However, my client (in Java) isn't sending its client
> certificate because the CertificateRequest message from the
> RabbitMQ/Erlang server is saying that it's requesting an RSA
> certificate, whereas all I have is an EC certificate. I'm trying to use
> cipher suite {ecdhe_ecdsa, aes_128_cbc, sha256} which I think is the
> correct one, but the place that specifies what types of certificates to
> request (ssl_handshake's certificate_types function) at
> https://github.com/erlang/otp/blob/maint-
> 17/lib/ssl/src/ssl_handshake.erl#L1110
> doesn't seem to handle this case correctly and always asks for just RSA
> rather than ECDSA certificate.
> 
> When I connect to the server using the same keys with "openssl
> s_client", the connection is established and the certificate gets sent
> fine, which leads me to think that openssl isn't checking for the type
> in the CertificateRequest message and is just sending the certificate I
> specify. So it looks like Erlang's SSL module can handle the
> certificate just fine if the client ignores the list of requested
> types.
> 
> Thanks for any help you could provide.

My apologies for the double-post, but I thought that showing a patch of a change that made the system work as expected for me would be helpful. This clearly isn't the way one should do this in general, as it's just handling the particular cipher I've chosen, but it looks like by the time it is figuring out the certificate type the cipher suite has already been mapped to the OpenSSL-equivalent name, and that name is what it's using to match. I'm not sure which ciphers accept just ECDSA, just RSA, or both, but since at least one accepts ECDSA there needs to be some more checking here of some sort. In the meantime, I've applied this patch to my system so I can continue developing my project. Thanks!

--- ssl-5.3.5\src\ssl_handshake.erl     Mon Jun 23 17:24:48 2014
+++ ssl-5.3.5-mod\src\ssl_handshake.erl Fri Jul 11 12:05:21 2014
@@ -1110,6 +1110,10 @@
        KeyExchange == dhe_ecdsa ->
     <<?BYTE(?ECDSA_SIGN)>>;

+certificate_types(Cipher)
+  when Cipher == ?TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 ->
+    <<?BYTE(?ECDSA_SIGN)>>;
+
 certificate_types(_) ->
     <<?BYTE(?RSA_SIGN)>>.



--
Peter Cooper Jr.
Sr. Software Engineer
EFI



More information about the erlang-bugs mailing list