Exemple #1
0
 def change_key(self):
     if not self.loaded:
         self.load()
     old_key = self.get_encryption_key()
     new_key = AESEncryption.generate_key()
     for user in self.users:
         user_key = KeyPair(pub_data=user['public_key'])
         user['encrypted_key'] = user_key.encrypt(new_key, encode_payload=True)
     self.save(encryption_key=new_key)
Exemple #2
0
    def create(self, data=None):
        self.users = []
        self.loaded = True
        keypair = self.get_private_keys()[0]
        encryption_key = AESEncryption.generate_key()
        self._add_user(self.user, keypair, encryption_key)

        payload = data or {}
        metdata = None
        self.save(payload, encryption_key=encryption_key)