当我们重用以前保存的SSL_SESSION
时,重用的SSL会话是否有原始X.509对等证书?
我的代码很少崩溃,调查显示SSL会话被重用,一些对等证书( peer,certinfo->key->pkey
)字段被混淆。
SSL_get_peer_certificate()
获得证书。CLT用SSL_SESSION
保存SSL_get1_session()
。SSL_SESSION
和SSL_set_session()
,并且发生了简短的握手。当CLT调用SSL_get_peer_certificate()
时,CLT能获得原始的X.509证书吗?与SSL_SESSION
和包含的对等X.509证书的耦合似乎是松散的。我们是否应该显式地保存X.509对等证书,除了调用SSL_get1_session
之外,还要在重用的SSL_SESSION
上正确地使用SSL_get_peer_certificate()
我在Linux上使用LibreSSL和OpenSSL。
如有任何意见,将不胜感激。
发布于 2018-05-09 10:36:39
如果您看到openssl代码,您将在SSL_SESSION
声明中找到以下注释:
/* This is the cert for the other end.
* On clients, it will be the same as sess_cert->peer_key->x509
* (the latter is not enough as sess_cert is not retained
* in the external representation of sessions, see ssl_asn1.c). */
X509 *peer;
我假设它表示对于客户端,当转换为外部表示时,对等证书不被保留,即当SSL_SESSION被序列化时,对等证书将丢失。
https://stackoverflow.com/questions/50250491
复制相似问题