使用 OpenSSL 进行基于 X.509 证书的身份验证(不使用套接字)

发布于 2024-08-26 06:53:43 字数 213 浏览 4 评论 0原文

OpenSSL 中是否有 SSL_set_connect_state()/SSL_set_accept_state() 的替代方案用于基于 X.509 证书的身份验证?

问题是在我的应用程序中,客户端和服务器不使用套接字进行通信,并且不可能在它们之间建立直接连接。因此,我希望 OpenSSL 能够“公开”中间 SSL 上下文建立消息,然后将其传达给另一端的一方。

感谢您的帮助!

Is there an alternative in OpenSSL to SSL_set_connect_state()/SSL_set_accept_state() for X.509 certificate based authentication?

The problem is that in my application the client and server do not communicate using sockets, and the establishment of direct connection between them is not possible. So what I want from OpenSSL is to 'expose' the intermediate SSL context establishment messages which I would then convey to the party at the other end.

Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧时光的容颜 2024-09-02 06:53:43

OpenSSL BIO 接口可用于此目的。

  1. 使用BIO_new_bio_pair()创建一个连接的 BIO 对。 SSL 例程将读取和写入一个 BIO,您的应用程序将读取和写入另一个 BIO(允许它通过所需的任何方法将数据传递到另一端)。

  2. 使用SSL_set_bio()一个新的 SSL 对象,用于将读取和写入 BIO 设置为生成的一对 BIO 之一。

  3. 在该对中的另一个 BIO 上使用 BIO_read()BIO_write() 来读取和写入 SSL 协议数据。

  4. 照常使用 SSL_accept()SSL_connect()SSL_read()SSL_write() SSL 对象。

The OpenSSL BIO interface can be used for this.

  1. Use BIO_new_bio_pair() to create a connected BIO pair. One BIO will be read from and written to by the SSL routines, and the other BIO will be read from and written to by your application (allowing it to pass the data to the other end by whatever method it desires).

  2. Use SSL_set_bio() on a new SSL object to set both the read and write BIO to one of the BIOs in the pair generated.

  3. Use BIO_read() and BIO_write() on the other BIO in the pair to read and write the SSL protocol data.

  4. Use SSL_accept(), SSL_connect(), SSL_read() and SSL_write() as normal on the SSL object.

痴意少年 2024-09-02 06:53:43

是的,您可以使用与 SSL 套接字层内容相同的 X.509 验证例程。

http://openssl.org/docs/crypto/x509.html

文档似乎这里有点欠缺......(你会认为他们已经完成了 1.0 的所有工作)。我不能说我熟悉该库的这方面,但 openssl 附带了一个命令行 x509 验证工具。您应该能够查看其源代码以了解如何执行此操作。

http://openssl.org/docs/apps/verify.html

Yes, you can use the same X.509 verification routines that the SSL socket layer stuff would.

http://openssl.org/docs/crypto/x509.html

The documentation seems to be a bit lacking here... (you'd think they'd have finished it all for 1.0). I can't say I'm familiar with this aspect of the library, but openssl comes with a command line x509 verification tool. You should be able to peek in it's source code for how to do it.

http://openssl.org/docs/apps/verify.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文