piermesh/docs/Cryptography/WhaleSong.md

2.3 KiB
Raw Blame History

WhaleSong

class Cryptography.WhaleSong.Transport(cache, nodeNickname, daisyCryptography, psk)

🔗 Source

loadedKeys

In memory representations of cryptography keys

  • Type: dict

nodeNickname

Name of node for isolating configs when running multiple nodes

  • Type: str

cache

Daisy cache for use in storing cryptography information

publicKey

Public key for node

privateKey

Private key for node

daisyCryptography

Record cryptography reference

addPeerEphemeralKey(onodeID, peerEphemeralKey: bytes)

Add a peer nodes epehemeral key for session encryption

onodeID
Node identifier
peerEphemeralKey: bytes
Serialized ephemeral key

addPublickey(onodeID, publicKey, forSelf: bool = False)

Add a public key for a given node including this one

onodeID
Node identifier
publicKey
Public key to add
forSelf: bool
Whether to add key for this node

decrypt(data, onodeID: str, nonce, tag)

Decrypt bytes and return either str or dict depending on result

onodeID: str
Node identifier
nonce
Encryption nonce
tag
Encryption tag

encrypt(data, nodeID: str, isDict: bool = True, pskEncrypt=False)

Encrypt given data with AES GCM

data
Either bytes or dict to encrypt
isDict: bool
Whether data is a dictionary
pskEncrypt: bool
Whether to encrypt with pre-shared key

genOurEphemeralKey(onodeID)

Generate epehemeral key for session encryption with given node

genStaticKey(onodeID)

Generate static key for session encryption with given node

generateSessionKey(onodeID)

Generate session key for transport encryption

onodeID
Node identifier

getRecord(store: str, key: str, ephemeral=False)

Get record from store: store with key: key

initStore(store: str)

Initialize store: store

kdf(bytesX)

Key derivation function

sessionSetup(onodeID, peerEphemeralKey: bytes)

Set up transport encryption session

onodeID
Node identifier
peerEphemeralKey: bytes
Serialized ephemeral key