title: Can One Public Key be Used to Encrypt and Decrypt Data during the SSL Handshake?
body: <p>When a server sends a Certificate message to a client, the public key in the server's certificate will be used to verify server’s identity(decryption with the public key).</p>
  <p>The server follows its Certificate message with a ServerKeyExchange message, the session key information is signed using the same public key contained in the server’s certificate (encryption with the public key).</p>
  <p>So I feel a Public key can be used to encrypt and decrypt data as well, am I right?
  If yes, I wonder why text book just states one key(e.g. public key) is used to encrypt , and the other one(private key) is used to decrypt, rather than mention that a key can be used to both encrypt and decrypt?</p>
  <p><strong>[UPDATE2]</strong><br/>
  Really thanks for Bruno's help.<br/></p>
  <p>After reading Bruno's replies and RFC4346(section7.4.2 and 7.4.3) again and again, I suddenly felt I grasp the main points. :)<br/>
  <strong>However, I am not sure I am right, and hope someone can confirm my following understanding. Thanks.</strong></p>
  <p>1.Server Certificate<br/>
  <em>SSL and TLS Essential</em> section 3.6.1:<br/>
  (<em><strong>SSL and TLS Essential: Securing the Web</strong></em>   Author: Stephen A. Thomas)<br/></p>
  <blockquote>
  <p>...the public key in the server's certificate will only be used to verify its(server) identity.</p>
  </blockquote>
  <p>Bruno wrote,<br/></p>
  <blockquote>
  <p>The public key in the server certificate isn't used to verify the server's identity itself.</p>
  </blockquote>
  <p>I agree Bruno's viewpoint now, because a certificate is only a private-key-signed(encrypted) message that also contains someone else's(e.g., a client ) public key, so a client should use its trusted copy of the server's public key (usually, web browsers include dozens of these certificates in advance), instead of the public key in the server certificate, to verify the server's identity.<br/></p>
  <p>Is it right?<br/></p>
  <p>2.Server Key Exchange<br/>
  SSL and TLS Essential section 3.6.2:<br/></p>
  <blockquote>
  <p>...the key information is signed using the public key contained in the server's certificate.</p>
  </blockquote>
  <p>Bruno wrote,<br/></p>
  <blockquote>
  <p>Similarly, you don't really sign something with a public key. You only need one of the keys to sign, and that's the private key. You verify the signature with the matching public key.
  ...
  &quot;signing with a public key&quot; is an unusual and misleading expression.</p>
  </blockquote>
  <p>I think Bruno is right. The reasons are as follows,</p>
  <p>RFC4346 section <a href="https://www.rfc-editor.org/rfc/rfc4346#section-7.4.2" rel="nofollow noreferrer">7.4.2. Server Certificate</a><br/></p>
  <blockquote>
  <p>It MUST contain a key that matches the key exchange method, as follows.</p>
  Key Exchange Algorithm           Certificate Key Type
  
       RSA                     RSA public key; the certificate MUST
                               allow the key to be used for encryption.
  
       DHE_DSS                 DSS public key.
  
       DHE_RSA                 RSA public key that can be used for signing.
  
       DH_DSS                  Diffie-Hellman key. The algorithm used
                               to sign the certificate MUST be DSS.
  
       DH_RSA                  Diffie-Hellman key. The algorithm used
                               to sign the certificate MUST be RSA.
  </blockquote>
  <p>So the server sends one of 6 public key types in a certificate first.</p>
  <br/>
  RFC4346 section [7.4.3 Server Key Exchange Message][2]<br/>
  >The server key exchange message is sent by the server.<br/>
  >...<br/>
  >This is true for the following key exchange methods:
  >
     DHE_DSS<br/>
     DHE_RSA<br/>
     DH_anon<br/>
  >...<br/>
  >This message conveys cryptographic information to allow the client to communicate the premaster secret.
  <p>The server chooses one of 3 key exchange methods, and uses its private key to sign(encrypt) cryptographic information.<br/></p>
  <p>When the client receives the encrypted cryptographic information, it will use the public key in ServerCertificate message to verify(decrypt) and get the plain-text cryptographic information. <br/></p>
  <p>Is it right?</p>