In no event should the server be allowed to sign data it generates itself and then return both the data and the signature to the client for verification. Let's talk about how to verify the supplied certificate in order to protect against these attacks. Therefore, to verify the certificate, you must validate the third-party signature on the certificate. In summary, the client verifies the server's certificate by examining the name on the certificate and determining whether or not it's the name of the server to which it desires to communicate. If the server's certificate has the right name, the client inspects the certificate's signature to determine whether or not it was generated by a CA that it trusts.
Authentication is complete.
Again, not quite. In practice the situation proves more complicated. First, it's possible that someone you don't know or trust signed the server certificate, but you have a certificate for this signer that was, in turn, signed by someone you do trust. In practice, these certificate chains can extend several generations. To verify the server certificate, you must verify every certificate in the chain all the way back to a trusted root certificate.