예제 #1
0
SSLPeerInfo TransportLayerLegacy::getX509PeerInfo(const Session& session) const {
    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);
        auto conn = _connections.find(session.id());
        if (conn == _connections.end()) {
            // Return empty string if the session is not found
            return SSLPeerInfo();
        }

        return conn->second.sslPeerInfo.value_or(SSLPeerInfo());
    }
}
SessionHandle TransportLayerMock::createSession() {
    auto session = createSessionHook ? createSessionHook(this) : MockSession::create(this);
    Session::Id sessionId = session->id();

    _sessions[sessionId] = Connection{false, session, SSLPeerInfo()};

    return _sessions[sessionId].session;
}
예제 #3
0
파일: sock.cpp 프로젝트: ksuarz/mongo
SSLPeerInfo Socket::doSSLHandshake(const char* firstBytes, int len) {
    if (!_sslManager)
        return SSLPeerInfo();
    fassert(16506, _fd != INVALID_SOCKET);
    if (_sslConnection.get()) {
        throw SocketException(SocketException::RECV_ERROR,
                              "Attempt to call SSL_accept on already secure Socket from " +
                                  remoteString());
    }
    _sslConnection.reset(_sslManager->accept(this, firstBytes, len));
    return _sslManager->parseAndValidatePeerCertificateDeprecated(_sslConnection.get(), "");
}
예제 #4
0
SSLPeerInfo TransportLayerLegacy::getX509PeerInfo(const ConstSessionHandle& session) const {
    auto legacySession = checked_pointer_cast<const LegacySession>(session);
    return legacySession->conn()->sslPeerInfo.value_or(SSLPeerInfo());
}