Пример #1
0
 virtual void save(const B::Session & session)
 {
     std::vector<byte> encrypted_value =
         session.encrypt(key, *rng);
     const std::vector<byte>& session_id = session.session_id();
     save_p(
         (char*) &(session_id[0]),
         session_id.size(),
         (char*) &(encrypted_value[0]),
         encrypted_value.size()
     );
 }
Пример #2
0
      std::vector<Test::Result> run() override
         {
         Test::Result result("TLS::Session");

         Botan::TLS::Session default_session;

         Botan::secure_vector<uint8_t> default_der = default_session.DER_encode();

         result.test_gte("Encoded default session has size", default_der.size(), 0);

         Botan::TLS::Session decoded_default(default_der.data(), default_der.size());

         Botan::TLS::Session session(std::vector<uint8_t>{0xAA, 0xBB},
                                     Botan::secure_vector<uint8_t>{0xCC, 0xDD},
                                     Botan::TLS::Protocol_Version::TLS_V12,
                                     0xFE0F,
                                     Botan::TLS::CLIENT,
                                     true,
                                     false,
                                     std::vector<Botan::X509_Certificate>(),
                                     std::vector<uint8_t>(),
                                     Botan::TLS::Server_Information("server"),
                                     "SRP username",
                                     0x0000);

         const Botan::SymmetricKey key("ABCDEF");
         std::vector<uint8_t> ctext1 = session.encrypt(key, Test::rng());
         std::vector<uint8_t> ctext2 = session.encrypt(key, Test::rng());

         result.test_ne("TLS session encryption is non-determinsitic",
                        ctext1.data(), ctext1.size(),
                        ctext2.data(), ctext2.size());

         Botan::TLS::Session dsession = Botan::TLS::Session::decrypt(ctext1.data(), ctext1.size(), key);

         result.test_eq("Decrypted session access works", dsession.srp_identifier(), "SRP username");

         return {result};
         }
Пример #3
0
      bool handshake_complete(const Botan::TLS::Session& session)
         {
         std::cout << "Handshake complete, " << session.version().to_string()
                   << " using " << session.ciphersuite().to_string() << std::endl;

         if(!session.session_id().empty())
            std::cout << "Session ID " << Botan::hex_encode(session.session_id()) << std::endl;

         if(!session.session_ticket().empty())
            std::cout << "Session ticket " << Botan::hex_encode(session.session_ticket()) << std::endl;

         return true;
         }
Пример #4
0
bool MumbleClient::OnHandshake(const Botan::TLS::Session& session)
{
	trace("[mumble] got session %s %s\n", session.version().to_string().c_str(), session.ciphersuite().to_string().c_str());

	return true;
}
Пример #5
0
bool SecureSocket::session(const Botan::TLS::Session &session)
{
    cout << session.server_info().hostname() << endl << flush;
    return true;
}