Example #1
0
 def GetCipher(self):
     if self.name == "AES128CBC":
         return rdf_crypto.AES128CBCCipher(self.key, self.metadata_iv)
Example #2
0
 def Encrypt(self, data, iv=None):
     """Symmetrically encrypt the data using the optional iv."""
     if iv is None:
         iv = rdf_crypto.EncryptionKey.GenerateKey(length=128)
     cipher = rdf_crypto.AES128CBCCipher(self.cipher.key, iv)
     return iv, cipher.Encrypt(data)
Example #3
0
 def Decrypt(self, data, iv):
     """Symmetrically decrypt the data."""
     key = rdf_crypto.EncryptionKey(self.cipher.key)
     iv = rdf_crypto.EncryptionKey(iv)
     return rdf_crypto.AES128CBCCipher(key, iv).Decrypt(data)