feature to encrypt peer connections with a secret AES-256 key stored in .torrent file
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
Reference in New Issue
Block a user