What makes SSL secure?

后端 未结 4 1589
名媛妹妹
名媛妹妹 2021-01-14 23:11

I\'ve been reading a few sites on the internet on how SSL works, but I don\'t understand how exactly it makes things secure. Probably because I don\'t understand completely

相关标签:
4条回答
  • 2021-01-14 23:31

    In order to encrypt a connection you have to agree to some shared secret. This can be done with diffie-hellman. To prevent man in the middle attacks, so you also need a certificate mechanism.

    For encrypting or signing (certificates) you can use asynchronous keys. This means you have two different keys (public and private key) to encrypt/decrypt. Usually you encrypt your data with a public key, and someone can decrypt it with his private key. Signing is done with your private key, and someone else can check it with a public key.

    So you see, faking a certificate is not that easy, since you don't have the private key from a root certificate provider.

    0 讨论(0)
  • 2021-01-14 23:32

    When using protocols such as Diffie-Hellman key exchange, the two parties to a communication each generate a random number, transform it in some way, and send the transformed version to the other party. The transformation is such that combining the first number with the transformed version of the second will yield the same result as combining the second number with the transformed version of the first. An adversary who only had the transformed numbers, however, would have no way of finding the un-transformed version of either, nor a way of computing what the result would be if the (unavailable) untransformed version of one number were combined with the (available) transformed version of the other.

    Diffie-Hellman key exchange by itself would be sufficient to protect against all forms of passive attack or historical attacks (meaning if an attacker hadn't taken steps to intercept a communication before it took place, it cannot later be compromised except by performing some calculations which could not, with anything resembling today's technology, be computed in any remotely feasible time). The problem with it is that it cannot very well protect against the situation where an attacker (e.g. Z) can intercept all communications between the participants (e.g. X and Y) and substitute his own. In that scenario, X would establish a connection with Z--thinking him to by Y--which nobody but he and Z could decode. Z would then--pretending to be X--establish a connection with Y.

    If X and Y have any pre-existing means of sharing information with each other in such a way that they can decode it much faster than Z, even if it's not terribly secure, this may suffice to prevent the above-described man-in-the-middle attack. All that needs to happen is for X and Y to ask each other something about the key they're using. If Z can recognize that question and substitute its own answer, it would be able to continue the ruse. On the other hand, if the question were asked in such a way that a legitimate party would be able to respond much more quickly than an imposter, Z might be stumped. As an example, if a voice-phone application displayed for each participant information about the negotiated key, and one party asked the other "read off digits 12 to 18 of your key, doing your best impression of Elmer Fudd" (selecting, on the spot, the digits to read and the voice to use) a legitimate participant would be able to respond immediately, but an attacker would need time to produce a phony recording of the person speaking as indicated).

    0 讨论(0)
  • 2021-01-14 23:42

    surely an encryption key needs to be shared. If someone is eavesdropping on your connection, wouldn't they just be able to grab this key

    No. The key is never transmitted. It is computed at both ends independently via a key-agreement algorithm.

    What prevents a rogue server from faking a certificate signed by a root certificate provider?

    The certificate is sent along with its digital signature which is made with the private key, and verified by the peer via the certificate's own public key. The server would need the private key of the server it is spoofing.

    0 讨论(0)
  • 2021-01-14 23:54

    First, some basic concepts about public key cryptography:

    • This relies on a pair of keys. One is the public key (which can be distributed); the other one is the private key, intended to be kept private.
    • You can encrypt data using the public key, which the private key can decrypt/decipher.
    • You can sign data using the private key, and this signature can be verified using the public key.

    To make sure you're communicating with the right entity, you need to bind an identity to a key-pair. This is where certificates come in. A public key certificate is a signed document containing both the subject's identity (name) and the subject's public key. For example, the certificate for www.google.com contains its public key and the name www.google.com. It has been signed using the private key of a Certification Authority (in this case, Thawte). In the X.509 terminology (the common standard for certificates used for HTTPS), the CA is the issuer of the certificate, and it puts its name in the certificate too, alongside the subject's name, the subject's public key (and other attributes). The issuers are meant to verify the identity of who they issue a certificate for.

    The reason you don't necessarily see your browser fetching information from the CAs is that a number of commercial (or governmental) CA certificates are bundled with your browser or your OS. You trust them by default. This can be considered as a "leap of faith", but any trust mechanism needs this sort of starting point.

    You may want to read more about the TLS handshake, but in short:

    • The client gets the server's public key by looking into its certificate.
    • The client encrypts a secret using this public key and sends it to the server. The details of this depend on the cipher suite (could be Diffie-Hellman based), but the result of this should be a list of shared encryption keys (using symmetric cryptography, not public key cryptography).
    • These shared keys are only known to the client and the server, and they're used for encryption/decryption.

    For SSL/TLS to be secure, you need at least 3 points:

    • A suitable cipher suite, and a successful handshake.
    • Verifying that the client trust the server certificate (typically, via a known CA in the PKI model).
    • Verifying that the certificate belongs to the server the client intended to contact (hostname verification).

    (This is the case for the vast majority of usages of SSL/TLS (in particular HTTPS), but it's also possible to use other mechanisms than X.509 certificates with TLS, for example OpenPGP certificate or Kerberos cipher suites. This is less common as far as I know.)

    0 讨论(0)
提交回复
热议问题