tor-spec.txt 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. $Id$
  2. TOR Spec
  3. Note: This is an attempt to specify TOR as it exists as implemented in
  4. early June, 2003. It is not recommended that others implement this
  5. design as it stands; future versions of TOR will implement improved
  6. protocols.
  7. TODO: (very soon)
  8. - Specify truncate/truncated
  9. - Sendme w/stream0 is circuit sendme
  10. - Integrate -NM and -RD comments
  11. 0. Notation:
  12. PK -- a public key.
  13. SK -- a private key
  14. K -- a key for a symmetric cypher
  15. a|b -- concatenation of 'a' with 'b'.
  16. a[i:j] -- Bytes 'i' through 'j'-1 (inclusive) of the string a.
  17. All numeric values are encoded in network (big-endian) order.
  18. Unless otherwise specified, all symmetric ciphers are 3DES in OFB
  19. mode, with an IV of all 0 bytes. Asymmetric ciphers are either RSA
  20. with 1024-bit keys and exponents of 65537, or DH with the safe prime
  21. from rfc2409, section 6.2, whose hex representation is:
  22. "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E08"
  23. "8A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B"
  24. "302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9"
  25. "A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE6"
  26. "49286651ECE65381FFFFFFFFFFFFFFFF"
  27. [We will move to AES once we can assume everybody will have it. -RD]
  28. 1. System overview
  29. Tor is a connection-oriented anonymizing communication service. Users
  30. build a path known as a "virtual circuit" through the network, in which
  31. each node knows its predecessor and successor, but no others. Traffic
  32. flowing down the circuit is unwrapped by a symmetric key at each node,
  33. which reveals the downstream node.
  34. 2. Connections
  35. 2.1. Establishing OR connections
  36. When one onion router opens a connection to another, the initiating
  37. OR (called the 'client') and the listening OR (called the 'server')
  38. perform the following handshake.
  39. [or when an op wants to connect to or]
  40. Before the handshake begins, the client and server know one
  41. another's (1024-bit) public keys, IPV4 addresses, and ports.
  42. 1. Client connects to server:
  43. The client generates a pair of 8-byte symmetric keys (one
  44. [K_f] for the 'forward' stream from client to server, and one
  45. [K_b] for the 'backward' stream from server to client.
  46. The client then generates a 'Client authentication' message [M]
  47. containing:
  48. The number 2 to signify OR handshake [2 bytes]
  49. The client's published IPV4 address [4 bytes]
  50. The client's published port [2 bytes]
  51. The server's published IPV4 address [4 bytes]
  52. The server's published port [2 bytes]
  53. The forward key (K_f) [16 bytes]
  54. The backward key (K_f) [16 bytes]
  55. The maximum bandwidth (bytes/s) [4 bytes]
  56. [Total: 50 bytes]
  57. The client then RSA-encrypts [M] with the server's public key
  58. and PKCS1 padding to give an encrypted message.
  59. The client then opens a TCP connection to the server, sends
  60. the 128-byte RSA-encrypted data to the server, and waits for a
  61. reply.
  62. 2. Server authenticates to client:
  63. Upon receiving a TCP connection, the server waits to receive
  64. 128 bytes from the client. It decrypts the message with its
  65. private key, and checks the PKCS1 padding. If the padding is
  66. incorrect, or if the message's length is other than 50 bytes,
  67. the server closes the TCP connection and stops handshaking.
  68. The server then checks the list of known ORs for one with the
  69. address and port given in the client's authentication. If no
  70. such OR is known, or if the server is already connected to
  71. that OR, the server closes the current TCP connection and
  72. stops handshaking.
  73. For later use, the server sets its keys for this connection,
  74. setting K_f to the client's K_b, and K_b to the client's K_f.
  75. The server then creates a server authentication message [M2] as
  76. follows:
  77. Modified client authentication [48 bytes]
  78. A random nonce [N] [8 bytes]
  79. [Total: 56 bytes]
  80. The client authentication is generated from M by replacing
  81. the client's preferred bandwidth [B_c] with the server's
  82. preferred bandwidth [B_s], if B_s < B_c.
  83. The server encrypts M2 with the client's public key (found
  84. from the list of known routers), using PKCS1 padding.
  85. The server sends the 128-byte encrypted message to the client,
  86. and waits for a reply.
  87. 3. Client authenticates to server.
  88. Once the client has received 128 bytes, it decrypts them with
  89. its public key, and checks the PKCS1 padding. If the padding
  90. is invalid, or the decrypted message's length is other than 56
  91. bytes, the client closes the TCP connection.
  92. The client checks that the addresses and keys in the reply
  93. message are the same as the ones it originally sent. If not,
  94. it closes the TCP connection.
  95. The client updates the connection's bandwidth to that set by
  96. the server, and generates the following authentication message [M3]:
  97. The client's published IPV4 address [4 bytes]
  98. The client's published port [2 bytes]
  99. The server's published IPV4 address [4 bytes]
  100. The server's published port [2 bytes]
  101. The server-generated nonce [N] [8 bytes]
  102. [Total: 20 bytes]
  103. Once again, the client encrypts this message using the
  104. server's public key and PKCS1 padding, and sends the resulting
  105. 128-byte message to the server.
  106. 4. Server checks client authentication
  107. The server once again waits to receive 128 bytes from the
  108. client, decrypts the message with its private key, and checks
  109. the PKCS1 padding. If the padding is incorrect, or if the
  110. message's length is other than 20 bytes, the server closes the
  111. TCP connection and stops handshaking.
  112. If the addresses in the decrypted message M3 match those in M
  113. and M2, and if the nonce in M3 is the same as in M2, the
  114. handshake is complete, and the client and server begin sending
  115. cells to one another. Otherwise, the server closes the TCP
  116. connection.
  117. 2.2. Establishing OP-to-OR connections
  118. [wrap this with the above]
  119. When an Onion Proxy (OP) needs to establish a connection to an OR,
  120. the handshake is simpler because the OR does not need to verify the
  121. OP's identity. The OP and OR establish the following steps:
  122. 1. OP connects to OR:
  123. First, the OP generates a pair of 8-byte symmetric keys (one
  124. [K_f] for the 'forward' stream from OP to OR, and one
  125. [K_b] for the 'backward' stream from OR to OP).
  126. The OP generates a message [M] in the following format:
  127. The number 1 to signify OP handshake [2 bytes]
  128. Maximum bandwidth (bytes/s) [4 bytes]
  129. Forward key [K_f] [16 bytes]
  130. Backward key [K_b] [16 bytes]
  131. [Total: 38 bytes]
  132. The OP encrypts M with the OR's public key and PKCS1 padding,
  133. opens a TCP connection to the OR's TCP port, and sends the
  134. resulting 128-byte encrypted message to the OR.
  135. 2. OR receives keys:
  136. When the OR receives a connection from an OP [This is on a
  137. different port, right? How does it know the difference? -NM],
  138. [Correct. The 'or_port' config variable specifies the OR port,
  139. and the op_port variable specified the OP port. -RD]
  140. it waits for 128 bytes of data, and decrypts the resulting
  141. data with its private key, checking the PKCS1 padding. If the
  142. padding is invalid, or the message is not 38 bytes long, the
  143. OR closes the connection.
  144. Otherwise, the connection is established, and the OR is ready
  145. to receive cells.
  146. The server sets its keys for this connection, setting K_f to
  147. the client's K_b, and K_b to the client's K_f.
  148. 2.3. Sending cells and link encryption
  149. Once the handshake is complete, the ORs or OR and OP send cells
  150. (specified below) to one another. Cells are sent serially,
  151. encrypted with the 3DES-OFB keystream specified by the handshake
  152. protocol. Over a connection, communicants encrypt outgoing cells
  153. with the connection's K_f, and decrypt incoming cells with the
  154. connection's K_b.
  155. [Commentary: This means that OR/OP->OR connections are malleable; I
  156. can flip bits in cells as they go across the wire, and see flipped
  157. bits coming out the cells as they are decrypted at the next
  158. server. I need to look more at the data format to see whether
  159. this is exploitable, but if there's no integrity checking there
  160. either, I suspect we may have an attack here. -NM]
  161. [Yes, this protocol is open to tagging attacks. The payloads are
  162. encrypted inside the network, so it's only at the edge node and beyond
  163. that it's a worry. But adversaries can already count packets and
  164. observe/modify timing. It's not worth putting in hashes; indeed, it
  165. would be quite hard, because one of the sides of the circuit doesn't
  166. know the keys that are used for de/encrypting at each hop, so couldn't
  167. craft hashes anyway. See the Bandwidth Throttling (threat model)
  168. thread on http://archives.seul.org/or/dev/Jul-2002/threads.html. -RD]
  169. [Even if I don't control both sides of the connection, I can still
  170. do evil stuff. For instance, if I can guess that a cell is a
  171. TOPIC_COMMAND_BEGIN cell to www.slashdot.org:80 , I can change the
  172. address and port to point to a machine I control. -NM]
  173. 3. Cell Packet format
  174. The basic unit of communication for onion routers and onion
  175. proxies is a fixed-width "cell". Each cell contains the following
  176. fields:
  177. ACI (anonymous circuit identifier) [2 bytes]
  178. Command [1 byte]
  179. Length [1 byte]
  180. Sequence number (unused, set to 0) [4 bytes]
  181. Payload (padded with 0 bytes) [248 bytes]
  182. [Total size: 256 bytes]
  183. The 'Command' field holds one of the following values:
  184. 0 -- PADDING (Padding) (See Sec 6.2)
  185. 1 -- CREATE (Create a circuit) (See Sec 4)
  186. 2 -- CREATED (Acknowledge create) (See Sec 4)
  187. 3 -- RELAY (End-to-end data) (See Sec 5)
  188. 4 -- DESTROY (Stop using a circuit) (See Sec 4)
  189. The interpretation of 'Length' and 'Payload' depend on the type of
  190. the cell.
  191. PADDING: Neither field is used.
  192. CREATE: Length is 144; the payload contains the first phase of the
  193. DH handshake.
  194. CREATED: Length is 128; the payload contains the second phase of
  195. the DH handshake.
  196. RELAY: Length is a value between 8 and 248; the first 'length'
  197. bytes of payload contain useful data.
  198. DESTROY: Neither field is used.
  199. Unused fields are filled with 0 bytes. The payload is padded with
  200. 0 bytes.
  201. PADDING cells are currently used to implement connection
  202. keepalive. ORs and OPs send one another a PADDING cell every few
  203. minutes.
  204. CREATE and DESTROY cells are used to manage circuits; see section
  205. 4 below.
  206. RELAY cells are used to send commands and data along a circuit; see
  207. section 5 below.
  208. 4. Circuit management
  209. 4.1. CREATE and CREATED cells
  210. Users set up circuits incrementally, one hop at a time. To create
  211. a new circuit, users send a CREATE cell to the first node, with the
  212. first half of the DH handshake; that node responds with a CREATED cell
  213. with the second half of the DH handshake. To extend a circuit past
  214. the first hop, the user sends an EXTEND relay cell (see section 5)
  215. which instructs the last node in the circuit to send a CREATE cell
  216. to extend the circuit.
  217. The payload for a CREATE cell is an 'onion skin', consisting of:
  218. RSA-encrypted data [128 bytes]
  219. Symmetrically-encrypted data [16 bytes]
  220. The RSA-encrypted portion contains:
  221. Symmetric key [16 bytes]
  222. First part of DH data (g^x) [112 bytes]
  223. The symmetrically encrypted portion contains:
  224. Second part of DH data (g^x) [16 bytes]
  225. The two parts of the DH data, once decrypted and concatenated, form
  226. g^x as calculated by the client.
  227. The relay payload for an EXTEND relay cell consists of:
  228. Address [4 bytes]
  229. Port [2 bytes]
  230. Onion skin [144 bytes]
  231. The port and address field denote the IPV4 address and port of the
  232. next onion router in the circuit.
  233. 4.2. Setting circuit keys
  234. Once the handshake between the OP and an OR is completed, both
  235. servers can now calculate g^xy with ordinary DH. They divide the
  236. last 32 bytes of this shared secret into two 16-byte keys, the
  237. first of which (called Kf) is used to encrypt the stream of data
  238. going from the OP to the OR, and second of which (called Kb) is
  239. used to encrypt the stream of data going from the OR to the OP.
  240. 4.3. Creating circuits
  241. When creating a circuit through the network, the circuit creator
  242. performs the following steps:
  243. 1. Choose a chain of N onion routers (R_1...R_N) to constitute
  244. the path, such that no router appears in the path twice.
  245. 2. If not already connected to the first router in the chain,
  246. open a new connection to that router.
  247. 3. Choose an ACI not already in use on the connection with the
  248. first router in the chain. If our address/port pair is
  249. numerically higher than the address/port pair of the other
  250. side, then let the high bit of the ACI be 1, else 0.
  251. 4. Send a CREATE cell along the connection, to be received by
  252. the first onion router.
  253. 5. Wait until a CREATED cell is received; finish the handshake
  254. and extract the forward key Kf_1 and the back key Kb_1.
  255. 6. For each subsequent onion router R (R_2 through R_N), extend
  256. the circuit to R.
  257. To extend the circuit by a single onion router R_M, the circuit
  258. creator performs these steps:
  259. 1. Create an onion skin, encrypting the RSA-encrypted part with
  260. R's public key.
  261. 2. Encrypt and send the onion skin in a RELAY_CREATE cell along
  262. the circuit (see section 5).
  263. 3. When a RELAY_CREATED cell is received, calculate the shared
  264. keys. The circuit is now extended.
  265. When an onion router receives an EXTEND relay cell, it sends a
  266. CREATE cell to the next onion router, with the enclosed onion skin
  267. as its payload. The initiating onion router chooses some random
  268. ACI not yet used on the connection between the two onion routers.
  269. When an onion router receives a CREATE cell, if it already has a
  270. circuit on the given connection with the given ACI, it drops the
  271. cell. Otherwise, sometime after receiving the CREATE cell, it completes
  272. the DH handshake, and replies with a CREATED cell, containing g^y
  273. as its [128 byte] payload. Upon receiving a CREATED cell, an onion
  274. router packs it payload into an EXTENDED relay cell (see section 5),
  275. and sends that cell up the circuit. Upon receiving the EXTENDED
  276. relay cell, the OP can retrieve g^y.
  277. (As an optimization, OR implementations may delay processing onions
  278. until a break in traffic allows time to do so without harming
  279. network latency too greatly.)
  280. 4.4. Tearing down circuits
  281. Circuits are torn down when an unrecoverable error occurs along
  282. the circuit, or when all streams on a circuit are closed and the
  283. circuit's intended lifetime is over. Circuits may be torn down
  284. either completely or hop-by-hop.
  285. To tear down a circuit completely, an OR or OP sends a DESTROY
  286. cell to the adjacent nodes on that circuit, using the appropriate
  287. direction's ACI.
  288. Upon receiving an outgoing DESTROY cell, an OR frees resources
  289. associated with the corresponding circuit. If it's not the end of
  290. the circuit, it sends a DESTROY cell for that circuit to the next OR
  291. in the circuit. If the node is the end of the circuit, then it tears
  292. down any associated edge connections (see section 5.1).
  293. After a DESTROY cell has been processed, an OR ignores all data or
  294. destroy cells for the corresponding circuit.
  295. To tear down part of a circuit, the OP sends a RELAY_TRUNCATE cell
  296. signaling a given OR (Stream ID zero). That OR sends a DESTROY
  297. cell to the next node in the circuit, and replies to the OP with a
  298. RELAY_TRUNCATED cell.
  299. When an unrecoverable error occurs along one connection in a
  300. circuit, the nodes on either side of the connection should, if they
  301. are able, act as follows: the node closer to the OP should send a
  302. RELAY_TRUNCATED cell towards the OP; the node farther from the OP
  303. should send a DESTROY cell down the circuit.
  304. [We'll have to reevaluate this section once we figure out cleaner
  305. circuit/connection killing conventions. -RD]
  306. 4.5. Routing data cells
  307. When an OR receives a RELAY cell, it checks the cell's ACI and
  308. determines whether it has a corresponding circuit along that
  309. connection. If not, the OR drops the RELAY cell.
  310. Otherwise, if the OR is not at the OP edge of the circuit (that is,
  311. either an 'exit node' or a non-edge node), it de/encrypts the length
  312. field and the payload with 3DES/OFB, as follows:
  313. 'Forward' relay cell (same direction as CREATE):
  314. Use Kf as key; encrypt.
  315. 'Back' relay cell (opposite direction from CREATE):
  316. Use Kb as key; decrypt.
  317. If the OR recognizes the stream ID on the cell (it is either the ID
  318. of an open stream or the signaling (zero) ID), the OR processes the
  319. contents of the relay cell. Otherwise, it passes the decrypted
  320. relay cell along the circuit if the circuit continues, or drops the
  321. cell if it's the end of the circuit. [Getting an unrecognized
  322. relay cell at the end of the circuit must be allowed for now;
  323. we can reexamine this once we've designed full tcp-style close
  324. handshakes. -RD]
  325. Otherwise, if the data cell is coming from the OP edge of the
  326. circuit, the OP decrypts the length and payload fields with 3DES/OFB as
  327. follows:
  328. OP sends data cell to node R_M:
  329. For I=1...M, decrypt with Kf_I.
  330. Otherwise, if the data cell is arriving at the OP edge if the
  331. circuit, the OP encrypts the length and payload fields with 3DES/OFB as
  332. follows:
  333. OP receives data cell:
  334. For I=N...1,
  335. Encrypt with Kb_I. If the stream ID is a recognized
  336. stream for R_I, or if the stream ID is the signaling
  337. ID (zero), then stop and process the payload.
  338. For more information, see section 5 below.
  339. 5. Application connections and stream management
  340. 5.1. Streams
  341. Within a circuit, the OP and the exit node use the contents of
  342. RELAY packets to tunnel end-to-end commands and TCP connections
  343. ("Streams") across circuits. End-to-end commands can be initiated
  344. by either edge; streams are initiated by the OP.
  345. The first 8 bytes of each relay cell are reserved as follows:
  346. Relay command [1 byte]
  347. Stream ID [7 bytes]
  348. The recognized relay commands are:
  349. 1 -- RELAY_BEGIN
  350. 2 -- RELAY_DATA
  351. 3 -- RELAY_END
  352. 4 -- RELAY_CONNECTED
  353. 5 -- RELAY_SENDME
  354. 6 -- RELAY_EXTEND
  355. 7 -- RELAY_EXTENDED
  356. 8 -- RELAY_TRUNCATE
  357. 9 -- RELAY_TRUNCATED
  358. All RELAY cells pertaining to the same tunneled stream have the
  359. same stream ID. Stream ID's are chosen randomly by the OP. A
  360. stream ID is considered "recognized" on a circuit C by an OP or an
  361. OR if it already has an existing stream established on that
  362. circuit, or if the stream ID is equal to the signaling stream ID,
  363. which is all zero: [00 00 00 00 00 00 00]
  364. To create a new anonymized TCP connection, the OP sends a
  365. RELAY_BEGIN data cell with a payload encoding the address and port
  366. of the destination host. The stream ID is zero. The payload format is:
  367. ADDRESS | ':' | PORT | '\000'
  368. where ADDRESS may be a DNS hostname, or an IPv4 address in
  369. dotted-quad format; and where PORT is encoded in decimal.
  370. Upon receiving this packet, the exit node resolves the address as
  371. necessary, and opens a new TCP connection to the target port. If
  372. the address cannot be resolved, or a connection can't be
  373. established, the exit node replies with a RELAY_END cell.
  374. Otherwise, the exit node replies with a RELAY_CONNECTED cell.
  375. The OP waits for a RELAY_CONNECTED cell before sending any data.
  376. Once a connection has been established, the OP and exit node
  377. package stream data in RELAY_DATA cells, and upon receiving such
  378. cells, echo their contents to the corresponding TCP stream.
  379. [XXX Mention zlib encoding. -NM]
  380. When one side of the TCP stream is closed, the corresponding edge
  381. node sends a RELAY_END cell along the circuit; upon receiving a
  382. RELAY_END cell, the edge node closes its side of the corresponding
  383. TCP stream (by sending a FIN packet), but continues to accept and
  384. package incoming data until both sides of the TCP stream are
  385. closed. At that point, the edge node sends a second RELAY_END
  386. cell, and drops its record of the stream.
  387. For creation and handling of RELAY_EXTEND and RELAY_EXTENDED cells,
  388. see section 4. For creating and handling of RELAY_SENDME cells,
  389. see section 6.
  390. 6. Flow control
  391. 6.1. Link throttling
  392. As discussed above in section 2.1, ORs and OPs negotiate a maximum
  393. bandwidth upon startup. The communicants only read up to that
  394. number of bytes per second on average, though they may use mechanisms
  395. to handle spikes (eg token buckets).
  396. Communicants rely on TCP's default flow control to push back when they
  397. stop reading, so nodes that don't obey this bandwidth limit can't do
  398. too much damage.
  399. 6.2. Link padding
  400. Currently nodes are not required to do any sort of link padding or
  401. dummy traffic. Because strong attacks exist even with link padding,
  402. and because link padding greatly increases the bandwidth requirements
  403. for running a node, we plan to leave out link padding until this
  404. tradeoff is better understood.
  405. 6.3. Circuit-level flow control
  406. To control a circuit's bandwidth usage, each OR keeps track of
  407. two 'windows', consisting of how many RELAY_DATA cells it is
  408. allowed to package for transmission, and how many RELAY_DATA cells
  409. it is willing to deliver to streams outside the network.
  410. Each 'window' value is initially set to 1000 data cells
  411. in each direction (cells that are not data cells do not affect
  412. the window). When an OR is willing to deliver more cells, it sends a
  413. RELAY_SENDME cell towards the OP, with Stream ID zero. When an OR
  414. receives a RELAY_SENDME cell with stream ID zero, it increments its
  415. packaging window.
  416. Either of these cells increment the corresponding window by 100.
  417. The OP behaves identically, except that it must track a packaging
  418. window and a delivery window for every OR in the circuit.
  419. An OR or OP sends cells to increment its delivery window when the
  420. corresponding window value falls under some threshold (900).
  421. If a packaging window reaches 0, the OR or OP stops reading from
  422. TCP connections for all streams on the corresponding circuit, and
  423. sends no more RELAY_DATA cells until receiving a RELAY_SENDME cell.
  424. 6.4. Stream-level flow control
  425. Edge nodes use RELAY_SENDME cells to implement end-to-end flow
  426. control for individual connections across circuits. Similarly to
  427. circuit-level flow control, edge nodes begin with a window of cells
  428. (500) per stream, and increment the window by a fixed value (50)
  429. upon receiving a RELAY_SENDME cell. Edge nodes initiate RELAY_SENDME
  430. cells when both a) the window is <= 450, and b) there are less than
  431. ten cell payloads remaining to be flushed at that edge.
  432. 7. Directories and routers
  433. 7.1. Router descriptor format.
  434. (Unless otherwise noted, tokens on the same line are space-separated.)
  435. Router ::= Router-Line Public-Key Signing-Key? Exit-Policy NL
  436. Router-Line ::= "router" address ORPort OPPort APPort DirPort bandwidth
  437. NL
  438. Public-key ::= a public key in PEM format NL
  439. Signing-Key ::= "signing-key" NL signing key in PEM format NL
  440. Exit-Policy ::= Exit-Line*
  441. Exit-Line ::= ("accept"|"reject") string NL
  442. ORport ::= port where the router listens for other routers (speaking cells)
  443. OPPort ::= where the router listens for onion proxies (speaking cells)
  444. APPort ::= where the router listens for applications (speaking socks)
  445. DirPort ::= where the router listens for directory download requests
  446. bandwidth ::= maximum bandwidth, in bytes/s
  447. Example:
  448. router moria.mit.edu 9001 9011 9021 9031 100000
  449. -----BEGIN RSA PUBLIC KEY-----
  450. MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
  451. 7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
  452. nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
  453. -----END RSA PUBLIC KEY-----
  454. signing-key
  455. -----BEGIN RSA PUBLIC KEY-----
  456. 7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
  457. MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
  458. f/GOm0iCIDpholeujQ95xew7rnZ7kVMRoiXCbjL6VAtNa4Zy1AQnAgMA//8=
  459. -----END RSA PUBLIC KEY-----
  460. reject 18.0.0.0/24
  461. Note: The extra newline at the end of the router block is intentional.
  462. 7.2. Directory format
  463. Directory ::= Directory-Header Directory-Router Router* Signature
  464. Directory-Header ::= "signed-directory" NL Software-Line NL
  465. Software-Line: "recommended-software" comma-separated-version-list
  466. Directory-Router ::= Router
  467. Signature ::= "directory-signature" NL "-----BEGIN SIGNATURE-----" NL
  468. Base-64-encoded-signature NL "-----END SIGNATURE-----" NL
  469. Note: The router block for the directory server must appear first.
  470. The signature is computed by computing the SHA-1 hash of the
  471. directory, from the characters "signed-directory", through the newline
  472. after "directory-signature". This digest is then padded with PKCS.1,
  473. and signed with the directory server's signing key.