/usr/lib/python3/dist-packages/libnacl/dual.py is in python3-libnacl 1.5.0-1.
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 | '''
The dual key system allows for the creation of keypairs that contain both
cryptographic and signing keys
'''
# import libnacl libs
import libnacl
import libnacl.base
import libnacl.public
import libnacl.sign
class DualSecret(libnacl.base.BaseKey):
'''
Manage crypt and sign keys in one object
'''
def __init__(self, crypt=None, sign=None):
self.crypt = libnacl.public.SecretKey(crypt)
self.signer = libnacl.sign.Signer(sign)
self.sk = self.crypt.sk
self.seed = self.signer.seed
self.pk = self.crypt.pk
self.vk = self.signer.vk
def sign(self, msg):
'''
Sign the given message
'''
return self.signer.sign(msg)
def signature(self, msg):
'''
Return just the signature for the message
'''
return self.signer.signature(msg)
|