gpt4 book ai didi

wcf - 将基于 RSA 的加密添加到没有证书的 WCF 服务

转载 作者:行者123 更新时间:2023-12-01 08:13:40 27 4
gpt4 key购买 nike

我正在寻找一种使用 WCF 在客户端和服务器之间加密消息的方法。 WCF 提供了许多内置的安全机制来加密客户端和服务器之间的流量,但似乎没有什么符合我的要求。
我不想使用证书 因为它们太复杂了,所以请不要建议我使用证书。我不需要保密,所以我最好使用纯 RSA。
我想要真正的安全 ,没有硬编码的 key 或其他东西。我正在考虑在每次服务器启动时生成一个公钥/私钥对。两个 key 都将仅存储在 RAM 中。
然后当客户端连接它应该完全像 SSL 一样。正如所描述的 here .

1.exchange some form of a private/public key pair; the server generates a key pair and keeps the private key to itself and shares the public key with the client (e.g. over a WCF message, for instance)

2.using that private/public key pair, exchange a common shared secret, e.g. an "encryption key" that will symmetrically encrypt your messages (and since it's symmetrical, the server can use the same key to decrypt the messages)

3.setup infrastructure on your client (e.g. a WCF extension called a behavior) to inspect the message before it goes out and encrypt it with your shared secret


那将是安全的,不是吗?
是否有任何现有的解决方案来归档我所描述的内容?如果没有,我会自己创建它。我从哪里开始最好?哪种 WCF 自定义行为最好实现?

编辑:
由于这不安全,我将采取以下方法:
安装服务器组件时,将生成新的 X509 证书并自动添加到(服务器的)证书存储区。此生成证书的公共(public)部分将动态包含在客户端设置中。在客户端计算机上运行客户端设置时,证书将安装到客户端的 trustet windows 证书存储中。
所以安装产品时没有额外的工作,一切都应该是安全的,就像我们想要的那样。

最佳答案

你说过你不想使用证书。我不会强制您使用证书,但是您缺少的一件事是证书是有目的的。

证书证明您正在与之协商 SSL 连接的 key 属于您认为它所属的实体。 如果您有某种方法可以在不使用证书的情况下确保这种情况,请务必使用原始 key 。

问题是,在第 1 步中:
1.exchange some form of a private/public key pair; the server generates a key pair and keeps the private key to itself and shares the public key with the client (e.g. over a WCF message, for instance)
客户端如何知道它从服务器接收到的公钥没有被中间人拦截并被 MITM 的 key 替换?

这就是证书存在的原因。如果您不想使用它们,则必须想出另一种解决此问题的方法。

你有一小群知名的客户吗?是否可以在客户端上预先配置服务器的公钥?

关于wcf - 将基于 RSA 的加密添加到没有证书的 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13177024/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com