开发者

openssl api verify the public key matches private key

开发者 https://www.devze.com 2023-01-03 02:35 出处:网络
How do I write an op开发者_如何学Pythonenssl server that on a single port has two different active RSA private keys? The openssl documentation seems to implies there can only be one rsa private key ac

How do I write an op开发者_如何学Pythonenssl server that on a single port has two different active RSA private keys? The openssl documentation seems to implies there can only be one rsa private key active at time with in a context. So I was thinking I have two active context, but what is the code to handle figuring out which connection matches which context. Or am I going about this the wrong way.


It's kind of an odd thing to want, but it's doable. You can maintain two active SSL_CTX handles, each of which has a different certificate/private key pair loaded.

When you accept a new connection, just pick the right SSL_CTX to generate the new SSL handle from (using SSL_new()). As for "which connection matches which certificate" - that's up to you to determine. You could decide based on the peer address of the connection, or you might have a plain text protocol prior to starting SSL where the peer identifies the certificate it is expecting.

0

精彩评论

暂无评论...
验证码 换一张
取 消