/usr/lib/python2.7/dist-packages/axolotl/identitykeypair.py is in python-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 | # -*- coding: utf-8 -*-
from .state.storageprotos_pb2 import IdentityKeyPairStructure
from .identitykey import IdentityKey
from .ecc.curve import Curve
class IdentityKeyPair:
def __init__(self, identityKeyPublicKey=None, ecPrivateKey=None, serialized=None):
if serialized:
structure = IdentityKeyPairStructure()
structure.ParseFromString(serialized)
self.publicKey = IdentityKey(bytearray(structure.publicKey), offset=0)
self.privateKey = Curve.decodePrivatePoint(bytearray(structure.privateKey))
else:
self.publicKey = identityKeyPublicKey
self.privateKey = ecPrivateKey
def getPublicKey(self):
return self.publicKey
def getPrivateKey(self):
return self.privateKey
def serialize(self):
structure = IdentityKeyPairStructure()
structure.publicKey = self.publicKey.serialize()
structure.privateKey = self.privateKey.serialize()
return structure.SerializeToString()
|