Is it possible to prevent man-in-the-middle attack when using self-signed certificates?

前端 未结 3 1618
感动是毒
感动是毒 2021-02-14 06:51

I\'m not sure is similar question has been asked before (I couldn\'t find any), but is it possible to protect Client/Server from Man-In-The-Middle attack?

I\'m writin

3条回答
  •  孤街浪徒
    2021-02-14 07:11

    You can hard-code the server's certificate and compare it against what you receive.

    Or better yet, create a CA certificate and server certificate, signed by the CA. Have the CA trusted on the client (again by hardcoding it in your application) and validate received server certificate using the CA certificate.

提交回复
热议问题