def decrypt(self, inp):
     if self.__private is None:
         raise KeyException("No private key, cannot encrypt!")
     return [
         solve(self.__public.k,
               i,
               self.__public.m,
               factors=[self.__private.p, self.__private.q]) for i in inp
     ]
Exemple #2
0
def dexponentiate(text, p, e):
    return __codec.decode(None, [solve(e, i, p) for i in text])
def unsign(nums, e_from, n_from, e_to, n_to):
    dec = [successive_square(solve(e_to, i, n_to), e_from, n_from) for i in nums]
    return __codec.decode(None, dec)
def sign(text, e_from, n_from, e_to, n_to):
    pair_encode = KeyPair(PublicKey(m=min(n_from, n_to), k=-1), None)
    nums = __codec.encode(pair_encode, text)
    return [successive_square(solve(e_from, i, n_from), e_to, n_to) for i in nums]
def dersa(nums, e, n):
    return __codec.decode(None, [solve(e, i, n) for i in nums])
    pass
 def decrypt(self, inp):
     if self.__private is None:
         raise KeyException("No private key, cannot encrypt!")
     return [solve(self.__public.k, i, self.__public.m, factors=[self.__private.p, self.__private.q]) for i in inp]
Exemple #7
0
def unsign(nums, e_from, n_from, e_to, n_to):
    dec = [
        successive_square(solve(e_to, i, n_to), e_from, n_from) for i in nums
    ]
    return __codec.decode(None, dec)
Exemple #8
0
def sign(text, e_from, n_from, e_to, n_to):
    pair_encode = KeyPair(PublicKey(m=min(n_from, n_to), k=-1), None)
    nums = __codec.encode(pair_encode, text)
    return [
        successive_square(solve(e_from, i, n_from), e_to, n_to) for i in nums
    ]
Exemple #9
0
def dersa(nums, e, n):
    return __codec.decode(None, [solve(e, i, n) for i in nums])
    pass