def encrypt(self, pk, M, object):
     key = self.group.random(GT)
     c1 = abenc.encrypt(pk, key, object)
     # instantiate a symmetric enc scheme from this key
     cipher = AuthenticatedCryptoAbstraction(sha1(key))
     c2 = cipher.encrypt(M)
     return { 'c1':c1, 'c2':c2 }
 def encrypt(self, pk, gp, M, policy_str):
     if type(M) != str and type(policy_str) != str: raise "message and policy not right type!"        
     key = group.random(GT)
     c1 = abencma.encrypt(pk, gp, key, policy_str)
     # instantiate a symmetric enc scheme from this key
     cipher = AuthenticatedCryptoAbstraction(sha1(key)) 
     c2 = cipher.encrypt(M)
     return { 'c1':c1, 'c2':c2 }
 def encrypt(self, pk, ID, M):
     if type(M) != str: raise "message not right type!"        
     key = group.random(GT)
     c1 = ibenc.encrypt(pk, ID, key)
     # instantiate a symmetric enc scheme from this key
     cipher = AuthenticatedCryptoAbstraction(sha1(key))
     c2 = cipher.encrypt(M)
     return { 'c1':c1, 'c2':c2 }
 def encrypt(self, pk, M):
     # generate a short session key, K and encrypt using pkenc
     key = urandom(self.key_len)
     # encrypt session key using PKEnc
     c1 = self.pkenc.encrypt(pk, key)
     # use symmetric key encryption to enc actual message
     cipher = AuthenticatedCryptoAbstraction(key)
     c2 = cipher.encrypt(M)
     if debug: print("Ciphertext 2...")
     if debug: print(c2)
     return { 'c1':c1, 'c2':c2 }
def SymEnc(s2_sesskey, M):
    getUserGlobals()
    cipher = AuthenticatedCryptoAbstraction(s2_sesskey)
    return cipher.encrypt(M)
Exemple #6
0
def SymEnc(s2_sesskey, M):
	getUserGlobals()
	cipher = AuthenticatedCryptoAbstraction(s2_sesskey)
	return cipher.encrypt(M)