@@ -532,6 +532,46 @@ auto TLSSession::peer() -> crypto::Certificate* {
532532 return m_peer;
533533}
534534
535+ auto TLSSession::cipher_name () -> std::string {
536+ return SSL_get_cipher_name (m_ssl);
537+ }
538+
539+ auto TLSSession::cipher_version () -> std::string {
540+ return SSL_get_cipher_version (m_ssl);
541+ }
542+
543+ auto TLSSession::cipher_bits () -> int {
544+ return SSL_get_cipher_bits (m_ssl, nullptr );
545+ }
546+
547+ auto TLSSession::negotiated_group () -> std::string {
548+ return SSL_group_to_name (m_ssl, SSL_get_negotiated_group (m_ssl));
549+ }
550+
551+ auto TLSSession::signature () -> std::string {
552+ int nid;
553+ SSL_get_signature_nid (m_ssl, &nid);
554+ return OBJ_nid2sn (nid);
555+ }
556+
557+ auto TLSSession::signature_type () -> std::string {
558+ int nid;
559+ SSL_get_signature_type_nid (m_ssl, &nid);
560+ return OBJ_nid2sn (nid);
561+ }
562+
563+ auto TLSSession::peer_signature () -> std::string {
564+ int nid;
565+ SSL_get_peer_signature_nid (m_ssl, &nid);
566+ return OBJ_nid2sn (nid);
567+ }
568+
569+ auto TLSSession::peer_signature_type () -> std::string {
570+ int nid;
571+ SSL_get_peer_signature_type_nid (m_ssl, &nid);
572+ return OBJ_nid2sn (nid);
573+ }
574+
535575void TLSSession::on_input (Event *evt) {
536576 if (m_closed_input) return ;
537577
@@ -1428,6 +1468,14 @@ template<> void ClassDef<TLSSession>::init() {
14281468 accessor (" protocol" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->protocol ()); });
14291469 accessor (" hostname" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->hostname ()); });
14301470 accessor (" peer" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->peer ()); });
1471+ accessor (" cipherName" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->cipher_name ()); });
1472+ accessor (" cipherVersion" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->cipher_version ()); });
1473+ accessor (" cipherBits" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->cipher_bits ()); });
1474+ accessor (" negotiatedGroup" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->negotiated_group ()); });
1475+ accessor (" signature" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->signature ()); });
1476+ accessor (" signatureType" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->signature_type ()); });
1477+ accessor (" peerSignature" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->peer_signature ()); });
1478+ accessor (" peerSignatureType" , [](Object *obj, Value &ret) { ret.set (obj->as <TLSSession>()->peer_signature_type ()); });
14311479}
14321480
14331481} // namespace pjs
0 commit comments