Add _derive_path_key

pull/79/head
tuxxy 2017-10-11 15:14:32 -06:00
parent 4527f0f93a
commit be78118254
No known key found for this signature in database
GPG Key ID: 7BB971A0E89144D9
1 changed files with 18 additions and 1 deletions

View File

@ -152,9 +152,26 @@ class EncryptingPower(CryptoPowerUp):
dirs = path.split(b'/')
return [b'/'.join(dirs[:i + 1]) for i in range(len(dirs))]
def _derive_path_key(
self,
path: bytes,
is_pub: bool = True
) -> bytes:
"""
Derives a key for the specific path.
:param path: Path to derive key for
:is_pub: Is the derived key a public key?
def encrypt(self,
:return: Derived key
"""
key = API.keccak_digest(self.priv_key, path)
if is_pub:
key = API.ecies_priv2pub(key)
return key
def encrypt(
self,
data: bytes,
recp_keypair: keypairs.EncryptingKeypair,
M: int,