What makes SSL secure?

后端 未结 4 1702
名媛妹妹
名媛妹妹 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: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.)

提交回复
热议问题