简体   繁体   English

专用服务器/客户端的自签名证书安全性

[英]Self-signed certificate security for private server/client

I've read a lot that self-signed certificates should never be used in production because of the lack of security but I wonder if it's still a security risk if I'm the only one who're supposed to connect to the server? 我已经读过很多书,由于缺乏安全性,不应在生产中使用自签名证书,但是我想知道,如果我是唯一应该连接到服务器的人,是否仍然存在安全风险? Is it for some reason easier to crack a self-signed certificate? 是否出于某种原因更容易破解自签名证书? I'm creating both the server and client application and the only way for someone else to connect is to create their own client. 我正在创建服务器和客户端应用程序,其他人连接的唯一方法是创建自己的客户端。 That means that every time I install the client I also have the possibility to add the certificate to the trusted root certificates. 这意味着每次我安装客户端时,我也可以将证书添加到受信任的根证书中。

Or is it safer to continue to use my own encryption implementation using RSA/AES on the message level? 还是在消息级别继续使用RSA / AES自己的加密实现更安全? The reason I want to use SSL instead is that it's much easier to work with, especially when I want to stream media since I don't have to send it in chunks. 我之所以要使用SSL的原因是,它使用起来要容易得多,尤其是当我要流媒体时,因为不必分块发送它。

I've read a lot that self-signed certificates should never be used in production because of the lack of security .... 我已经读过很多书,由于缺乏安全性,因此不应在生产中使用自签名证书。

Self-signed certificates by itself are not bad and can also used in production if done properly. 自签名证书本身也不错,如果正确完成,也可以在生产中使用。

A certificates is safe to use if the peer is able to verify it properly. 如果对等方能够正确验证证书,则可以安全使用。 The usual validation is done based on some trusted root CA contained in the browser or operating system. 通常的验证是基于浏览器或操作系统中包含的某些受信任的根CA进行的。 But that a self-signed certificate can not be validated this way does not mean that it cannot be validated at all because: 但是,无法以这种方式验证自签名证书,并不表示它根本无法验证,原因是:

  • You can explicitly add it as trusted to the certificate store of the browser/OS. 您可以将其显式添加为受信任的浏览器/ OS的证书存储。
  • You can make an exception on first use after you've verified that the certificate you get in the browser is actually the one which you know (by comparing the fingerprint, not just the subject). 在确认您在浏览器中获得的证书实际上是您所知道的证书之后,可以在首次使用时进行例外处理(通过比较指纹,而不仅仅是对象)。
  • If you have your own application you could ship the application so that it (only) trusts this certificate. 如果您拥有自己的应用程序,则可以交付该应用程序,以便它(仅)信任此证书。

Of course explicitly importing the certificate as trusted or making in exception in the browser does not scale well, because it has do be done for each user. 当然,将证书显式导入为受信任证书或在浏览器中进行例外设置并不能很好地扩展,因为这样做是针对每个用户完成的。 And that's the main point of CA-signed certificates: that the certificate gets implicitly trusted because it is signed by someone trusted instead of that each user has to validate and trust the certificate manually. 这就是CA签名证书的重点:证书被隐式信任,因为它是由受信任的人签名的,而不是每个用户都必须手动验证和信任证书。 And this is also the only reason you want to use a CA-signed certificate in production. 这也是您要在生产中使用CA签名证书的唯一原因。 As long as the certificate is properly validated it does not matter if it was self-signed or not. 只要证书已正确验证,它是否是自签名的都没有关系。

Or is it safer to continue to use my own encryption implementation using RSA/AES on the message level? 还是在消息级别继续使用RSA / AES自己的加密实现更安全?

Never run your own crypto unless you really understand what you are doing. 除非您真正了解自己在做什么,否则请不要运行自己的加密货币。 In this case SSL provides everything you need but you have to know how to use it properly. 在这种情况下,SSL提供了您所需的一切,但您必须知道如何正确使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM