File: derivedmessagesecrets.py

package info (click to toggle)
python-axolotl 0.2.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid
  • size: 592 kB
  • sloc: python: 2,962; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (3)
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
# -*- coding: utf-8 -*-

from ..util.byteutil import ByteUtil


class DerivedMessageSecrets:
    SIZE = 80
    CIPHER_KEY_LENGTH = 32
    MAC_KEY_LENGTH = 32
    IV_LENGTH = 16

    def __init__(self, okm):
        keys = ByteUtil.split(okm,
                              self.__class__.CIPHER_KEY_LENGTH,
                              self.__class__.MAC_KEY_LENGTH,
                              self.__class__.IV_LENGTH)
        self.cipherKey = keys[0]  # AES
        self.macKey = keys[1]  # sha256
        self.iv = keys[2]

    def getCipherKey(self):
        return self.cipherKey

    def getMacKey(self):
        return self.macKey

    def getIv(self):
        return self.iv