void alert_cb (buffers_t* buffers, Botan::TLS::Alert const& alert, const unsigned char a[], size_t sz) 
{
    TRACE("BOTAN WAS TO DELIVER ALERT: %s \n", alert.type_string().c_str());
    // TODO: find something better to do here
    buffers->alert_produced = true;
    buffers->which_alert = (int)alert.type();
    if ( alert.type() == Botan::TLS::Alert::CLOSE_NOTIFY)
    {
        TRACE("PeerASKED to close TLS transport\n");
        buffers -> peer_closed_transport = true;
    }
    else if (alert.is_valid() && alert.is_fatal() )
    {
        if ( alert.type() == Botan::TLS::Alert::DECRYPT_ERROR )
        {
            std::cout << "TLS Layer issue: Decrypt error. Probable cause: " ;
            std::cout << "the private key and the certificate don't match." ;
        } else
        {
            std::cout << "TLS Layer issue: " ;
            std::cout << alert.type_string() << std::endl;
        }
        buffers->alert_is_fatal = true;
        TRACE("TLS alert is fatal!!\n");
    } else {
        std::cout << alert.type_string() << std::endl;
        TRACE("Non-fatal alert!!\n");
    }
}
Exemple #2
0
void MumbleClient::OnAlert(Botan::TLS::Alert alert, const uint8_t[], size_t)
{
	trace("[mumble] TLS alert: %s\n", alert.type_string().c_str());

	if (alert.is_fatal())
	{
		closesocket(m_socket);

		m_connectionInfo.isConnected = false;
	}
}
void alert_cb (void* botan_pad_ref, Botan::TLS::Alert const& alert, const unsigned char a[], size_t sz) 
{
    // printf("BOTAN WAS TO DELIVER ALERT: %d \n", alert.type_string().c_str());
    if (alert.is_valid() && alert.is_fatal() )
    {
        // TODO: Propagate this softly.
        iocba_alert_cb(botan_pad_ref, -1);
    } else {
        // printf("Ignore an alert!!\n");
    }
}