The protocol you described addresses one attack, that is, a replay attack. However, you are very vulnerable to MITM attacks. A TCP connection will not drop when an attacker enters the protocol. Moreover, everything that is transmitted through this system can be sniffed. If you are on a wireless network in a cafe, everyone in this area will be able to sniff everything that is transmitted, and then a MITM authenticated session. Another thing is that sha1 () is proven to be insecure, you should use sha256 for anything related to security.
NEVER EXPOSE A WHEEL, especially when it comes to safety.
SSL! SSL secuirty, , . SSL Man in the Middle Attacks, , , . , 2048- RSA. , , , .
, OpenSSL , , . , , - PKI, , , . , . . OCSP CRL .