ntorhandshake

Details

NTorHandsake objects provide the methods for doing the ntor handshake key derivations and crypto operations. NTorHandshakes objects do the following jobs:

  • Create temporary public/private Curve 25519 keys
  • Create the initial onion skin
  • Derive key material from a Created2 or Extended2 cell
  • Create and initialize a RelayCrypto object, ready for use by a circuit (RelayCrypto objects are just wrappers around AES128-CTR ciphers and SHA-1 running digests, initialized with the derived key material)

Warning

NTorHandshakes do not safely erase/clear memory of private keys.

class crypto.ntorhandshake.NTorHandshake(relay)[source]

Bases: object

createOnionSkin()[source]

Build and return an onion skin to this handshake’s relay.

Note

See tor-spec Section 5.1.4 for more information.

Returns:str raw byte string for this onion skin
deriveRelayCrypto(cell)[source]

Derive shared key material for this ntor handshake; create and return actual cipher and hash instances inside a RelayCrypto object.

Note

See tor-spec Section 5.1.4, 5.2.2 for more details.

Parameters:cell (cell) – Created2 cell or Extended2 cell used to derive shared keys
Returns:oppy.crypto.relaycrypto.RelayCrypto object initialized with the derived key material.

Previous topic

crypto

Next topic

relaycrypto

This Page