/usr/lib/python3/dist-packages/axolotl/ratchet/rootkey.py is in python3-axolotl 0.1.39-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # -*- coding: utf-8 -*-
from ..ecc.curve import Curve
from ..kdf.derivedrootsecrets import DerivedRootSecrets
from .chainkey import ChainKey
class RootKey:
def __init__(self, kdf, key):
self.kdf = kdf
self.key = key
def getKeyBytes(self):
return self.key
def createChain(self, ECPublicKey_theirRatchetKey, ECKeyPair_ourRatchetKey):
sharedSecret = Curve.calculateAgreement(ECPublicKey_theirRatchetKey, ECKeyPair_ourRatchetKey.getPrivateKey())
derivedSecretBytes = self.kdf.deriveSecrets(sharedSecret,
bytearray("WhisperRatchet".encode()),
DerivedRootSecrets.SIZE,
salt=self.key)
derivedSecrets = DerivedRootSecrets(derivedSecretBytes)
newRootKey = RootKey(self.kdf, derivedSecrets.getRootKey())
newChainKey = ChainKey(self.kdf, derivedSecrets.getChainKey(), 0)
return (newRootKey, newChainKey)
|