BEP: | 35 |
---|---|
Title: | Torrent Signing |
Version: | 9c5c1dd1b372016e05af84fb34fccac6752ef54a |
Last-Modified: | Thu Jul 21 10:45:38 2016 -0400 |
Author: | Chris Brown <cbrown@bittorrent.com> |
Status: | Draft |
Type: | Standards Track |
Created: | 27-July-2012 |
Post-History: |
When users open torrents, they normally receive a warning to alert them of the fact that the contents may be dangerous. If we can be confident that the torrent came from a trusted source, we can forego this unnecessary hassle and users can feel safer about downloading these files.
To identify the source of a torrent, RSA signatures can be embedded into the .torrent file. These signatures can verify that the contents of the torrent have been unaltered, and by maintaining a database of trusted sources within the client, we can in turn trust the contents of the torrent.
Furthermore, an entity that signs a torrent doesn't necessarily have to represent the source of the torrent. It can represent anyone who endorses the torrent and vouches for it's safety and authenticity. Thus, a torrent may have multiple signatures.
If the .torrent file is signed, it contains a signatures key whose value is a dictionary. This dictionary's keys are unique identifiers of the signing entity in reverse-dns notation (e.g. com.bittorrent). To avoid conflicts, it's highly recommended that each identifier be based on a registered domain name that is owned by the signing entity. The corresponding value for each key is another dictionary whose keys are as follows:
Signature Keys
A certificate will be trusted if it is signed by a trusted entity. However, certificate chains of arbitrary length are not yet allowed.
Format Overview
{ "announce": ..., "info": { ... }, "signatures": { "com.bittorrent": { "certificate": optional, DER encoded x.509 certificate, "info": { ... } optional, "signature": signed data = info + sig info if present, }, ... } }
These steps provide OpenSSL commands as examples, but can also be done with other tools.
openssl genrsa -des3 -out privkey.pem 2048
openssl req -new -key privkey.pem -out cert.csr
OpenSSL is provided as an example, but this can also be done with other tools.
Configure OpenSSL to not add any extensions to the certificate. This should make the certificate V1 which greatly reduces its size. To do this, comment out the following line in your openssl.cnf file:
x509_extensions = usr_cert # The extensions to add to the cert
Common locations of openssl.cnf:
OSX: /System/Library/OpenSSL/openssl.cnf Ubuntu: /etc/ssl/openssl.cnf RedHat: /etc/pki/tls/openssl.cnf Other: /usr/lib/ssl/openssl.cnf /usr/local/ssl/openssl.cnf /usr/local/openssl/openssl.cnf
Run the following command in OpenSSL. The serial number (after -set_serial) MUST be unique for ALL certificates you issue!
openssl x509 -req -days 365 -in cert.csr -CA cert.pem -CAkey privkey.pem -set_serial 01 -out newcert.pem
This document has been placed in the public domain.