feature to encrypt peer connections with a secret AES-256 key stored in .torrent file

This commit is contained in:
Arvid Norberg
2011-09-05 05:50:41 +00:00
parent 43c9e640ab
commit 92bcb9ebfd
17 changed files with 397 additions and 69 deletions

View File

@@ -1115,7 +1115,7 @@ namespace libtorrent
&& t->to_req(piece_block(p.piece, p.start / t->block_size())) == p;
}
void peer_connection::attach_to_torrent(sha1_hash const& ih)
void peer_connection::attach_to_torrent(sha1_hash const& ih, bool allow_encrypted)
{
INVARIANT_CHECK;
@@ -1148,6 +1148,14 @@ namespace libtorrent
return;
}
#ifdef TORRENT_USE_OPENSSL
if (t->torrent_file().encryption_key().size() == 32 && !allow_encrypted)
{
disconnect(errors::invalid_info_hash, 2);
return;
}
#endif
if (t->is_paused() && (!t->is_auto_managed()
|| !m_ses.m_settings.incoming_starts_queued_torrents))
{