This file is indexed.

/usr/lib/python3/dist-packages/axolotl/ratchet/chainkey.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-

import hmac
import hashlib

from ..kdf.derivedmessagesecrets import DerivedMessageSecrets
from ..kdf.messagekeys import MessageKeys


class ChainKey:
    MESSAGE_KEY_SEED = bytearray([0x01])
    CHAIN_KEY_SEED = bytearray([0x02])

    def __init__(self, kdf, key, index):
        self.kdf = kdf
        self.key = key
        self.index = index

    def getKey(self):
        return self.key

    def getIndex(self):
        return self.index

    def getNextChainKey(self):
        nextKey = self.getBaseMaterial(self.__class__.CHAIN_KEY_SEED)
        return ChainKey(self.kdf, nextKey, self.index + 1)

    def getMessageKeys(self):
        inputKeyMaterial = self.getBaseMaterial(self.__class__.MESSAGE_KEY_SEED)
        keyMaterialBytes = self.kdf.deriveSecrets(inputKeyMaterial,
                                                  bytearray("WhisperMessageKeys".encode()),
                                                  DerivedMessageSecrets.SIZE)
        keyMaterial = DerivedMessageSecrets(keyMaterialBytes)
        return MessageKeys(keyMaterial.getCipherKey(), keyMaterial.getMacKey(), keyMaterial.getIv(), self.index)

    def getBaseMaterial(self, seedBytes):
        mac = hmac.new(bytes(self.key), digestmod=hashlib.sha256)
        mac.update(bytes(seedBytes))
        return mac.digest()