My server may be attached to a RSA or ECDSA certificate.
In my code I set the prtocol method as
sslmethod = SSLv23_server_method();
and setting the cipher using the SSL_CTX_set_cipher_list() API.
The problem is when the server is attached to ECDSA certificate and if I pass "RSA" cipher SSL_CTX_set_cipher_list() does not return any error though "RSA" cipher is not compatible with ECDSA certificates.
Is there any openssl API which I can use to find out if the cipher we are going to set is compatible with the certificate or with protocol or not?
Is there any openssl API which I can use to find out if the cipher we are going to set is compatible with the certificate or with protocol or not?
If you author the app and own the server, then YES, you do know what to expect. But the general case is NO, you don't know in advance and you can't query for it. You try to setup a channel and if it fails, then you try something else.
Generally speaking, there's no way to know in advance what cipher suites a server supports; or what type of public key is bound in the server's certificate. In fact, there's no way to know what protocol versions (SSLv2, SSLv3, TLS 1.0, TLS 1.1, TLS 1.2, etc) a server supports. Its the reason for RFC 7405, TLS Fallback Signaling Cipher Suite Value (SCSV) for Preventing Protocol Downgrade Attacks.
In 2016/2017, about the best you can do is assume:
No SSLv2, SSLv3; only TLS 1.0 and above
Cipher suites from the collection "HIGH:!aNULL:!kRSA:!RC4:!MD5"
"!kRSA" is "no RSA key transport", and it means you can only use ephemeral key exchanges. If a server has a RSA key, then it will only be used for authentication. That is, the key will be used to sign the server's ephemeral values during key exchange so the client knows they are authentic.
Related
I am using mbedtls on my TLS application. I've a question about the cipher suites.
When I debug my process, I get below lines from server side:
selected ciphersuite: TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256
What is the reason for selecting this CHACHA20-POLY1305 cipher ? Key? or certificate? or something else?
How can I change my chipher suite to TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256?
What is the reason for selecting this CHACHA20-POLY1305 cipher
The ciphers supported by the server and by the client, including their preferences. Thus it depends on client and server configurations and on their TLS stacks.
How can I change my chipher suite to TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256?
The RSA in the currently chosen cipher suite means that an RSA certificate was used for authentication. The ECDSA in the cipher you want means that the server needs to use a ECDSA certificate instead, i.e. you cannot achieve this with an RSA certificate.
Some servers can use both a RSA and ECDSA certificate in which case the choice of certificate depends again on client and server configuration regarding supported ciphers, preference etc.
I have traffic between clients (which send XML over HTTPS) to my IIS.
I tried to decrypt the traffic using Wireshark and the following settings:
Adding the private key:
But even after setting this, I can't see the decrypted data:
Should I change any other settings to see the original data?
There is strong possibility that a Diffie-Hellman (DH) key exchange is being used here. In that case Wireshark cannot decipher SSL/TLs with a private key. You can check for this in the handshake packet.
From the Docs:
The RSA private key file can only be used in the following
circumstances:
The cipher suite selected by the server is not using (EC)DHE.
The protocol version is SSLv3, (D)TLS 1.0-1.2. It does not work with TLS 1.3.
The private key matches the server certificate. It does not work with the client certificate, nor the Certificate Authority (CA)
certificate.
The session has not been resumed. The handshake must include the ClientKeyExchange handshake message.
I am using ECC certificate to observe how TLS works,Can someone helps me the difference between ECDH-ECDSA-AES128-SHA256 and ECDHE-ECDSA-AES128-SHA256.
When use ECDHE-ECDSA-AES128-SHA256,client and server works fine.
New, TLSv1/SSLv3, Cipher is ECDHE-ECDSA-AES128-SHA256
Server public key is 256 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-ECDSA-AES128-SHA256
When use ECDH-ECDSA-AES128-SHA256 ,the SERVER_HELLO fails:
140344027961248:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:769:
The difference is the key exchange algorithm.
ECDH - Elliptic Curve Diffie-Hellman Key Exchange
ECDHE - ECDH in ephemeral mode
ECDH in static mode uses a long term ECDH key.
In ephemeral mode, a ECDH key pair is generated every time and then thrown away, so it's only used with the length of the ECDH key exchange.
Update:
The server is rejecting the ECDH version because it'b been configured to do so.
All SSL implementations allow user to setup what ciphers are allowed or not.
In openssl we have a API like SSL_CTX_set_cipher_list to setup what ciphers are allowed or not. This is normally exposed through a application specific configuration.
There are a lot of web sites like this one that gives advice on what to set the cipher list too that gives the best security for that current situation now.
For information on cipher string see the openssl ciphers command.
I have an existing server that is using the following setting.
The connection to this site uses TLS 1.2 (a strong protocol), RSA (an
obsolete key exchange), and AES_128_CBC with HMAC-SHA1 (an obsolete cipher).
If I want to change the key exchange and cipher, do I need to get a new certificate?
The cipher is (mostly) unrelated to the certificate. Given that you are using a RSA certificate (since otherwise RSA key exchange would not be possible) you can switch to ECDHE key exchange. And instead of AES-128-CBC you might use AES-128-GCM or AES-256. For useful configurations you might use the Mozilla SSL Configuration Generator.
When using a VPN-like connection between the two servers (not web servers or anything like it), besides authentication I would like to enable encryption.
The authentication portion is already working, wanted some help at the encryption level.
I know that TLSv1.2 and v1.1 is supported alongside wih SSLv3.
I would only like to use TLSv1.2 and nothing else.
TLSv1.2:!aNULL:!eNULL
Is the the correct cipher suite to use?
Information from https://www.openssl.org/docs/manmaster/apps/ciphers.html seems not to be very helpful...
Can anyone help this this matter?
I would only like to use TLSv1.2 and nothing else.
If you want to use TLS 1.2 only you have to configure the protocol and not the ciphers. Limiting the ciphers to only TLS 1.2 ciphers drops support for all ciphers which are available since SSL 3.0 and which are still supported by TLS 1.2. Depending on the peer you might end up with no shared ciphers this way.
If you still want to restrict the ciphers you might try the string TLSv1.2:!aNULL:!eNULL. This will make it only use ciphers newly introduced in TLS 1.2 and thus implicitly enforce the protocol. But again, it is no guarantee that the server supports these ciphers even if the server can do the TLS 1.2 protocol.