I just came to learn about Deffie Hellman Key Exchange. And a little bit about RSA. I came to DH from something about SSL. From what I understood before is that SSL uses DH and TLS uses RSA, but after some research, came to know DH and RSA are both secure/insecure, slow/fast in their own ways, and Both SSL and TLS can use both of them. Here I am confused. What uses what? And how can RSA work on DH? Coz the public key in DH is made by an exchange which is kinda symmetric unlike RSA which is Pure asymmetric Public/Private key crypto. Can you "Simply" put me in the right track? Thanks :-)
From what I understood before is that SSL uses DH and TLS uses RSA
First of all, there are a sequence of published versions of the SSL protocol:
SSLv2, SSLv3, TLS1.0, TLS1.1, TLS1.2, TLS1.3
(the name changed from SSL to TLS when the IETF started being in charge of it; Mozilla supposedly had an SSLv1 version internally, but they never published it).
Now, SSLv2 and SSLv3 use only RSA to perform key exchange; no other option.
When you get to TLS 1.0, they allowed you to select between RSA or Diffie Hellman (DH) to do key exchange; the general tendency over time has been to rely less on RSA and more on DH, until you get to TLS 1.3 (the most recent version) that entirely drops the use of RSA to do key exchange.
BTW: nowadays you shouldn't be using a version earlier than TLS 1.2, and using TLS 1.3 is generally accepted as best practice.
came to know DH and RSA are both secure/insecure
Well, both can certainly used insecurely; however done correctly, both are secure.
Coz the public key in DH is made by an exchange which is kinda symmetric unlike RSA which is Pure asymmetric Public/Private key crypto.
Well, no, DH is considered asymmetric crypto (well, both sides actually perform the same operation, however that's not what we mean by symmetric). In fact, DH was the first published asymmetric crypto protocol; that is, it was published in the same paper that Diffie and Hellman first publicly introduced the idea of public key crypto.
What it is not is a public key encryption algorithm (however, with a bit of tweaking, it can become one); each side has a private key (which, if leaks, breaks the security of the system) and a public key (which is the key share that is publicly sent over to the other side, and which we assume the attacker can learn).
DH in the classic form can be vulnerable to MITM, but the form used in TLS (SSL is deprecated, and hardly used any more, TLS is the more secure successor) is that the server sends its DH-contribution (and parameters used) to the client trying to connect, and these are signed by RSA and the server also presents a valid certifacate with its public key (backed by certificate authorities) so that the client can check the validity of that signature and then sends its contribution (now knowing the parameters and the reliability of the received data). Now both parties can compute a shared masterkey (which is then mutually verified (again to exclude MITM again) and used to derive the symmetric MAC and/or encryption keys).
So DH (often over elliptic curves in the modern suites) is used, but signed/verified by RSA signatures server side.
The most recent form of TLS does not use RSA for key transport anymore (because if the private RSA key is lost, all previous traffic can be decrypted retroactively) and so DH is preferred to create a fresh problem for each connection essentially. RSA is then only used in certificates and signatures for MITM protection and authentication.