예제 #1
0
 def _save_instance_password_if_sshkey_present(self, new_pass):
     sshkey = self.instance.get('key_data')
     if sshkey and sshkey.startswith("ssh-rsa"):
         ctxt = context.get_admin_context()
         enc = crypto.ssh_encrypt_text(sshkey, new_pass)
         self.instance.system_metadata.update(
             password.convert_password(ctxt, base64.b64encode(enc)))
         self.instance.save()
예제 #2
0
 def test_ssh_encrypt_decrypt_text(self):
     enc = crypto.ssh_encrypt_text(self.pubkey, self.text)
     self.assertNotEqual(enc, self.text)
     result = self._ssh_decrypt_text(self.prikey, enc)
     self.assertEqual(result, self.text)
예제 #3
0
 def test_ssh_encrypt_decrypt_text(self):
     enc = crypto.ssh_encrypt_text(self.pubkey, self.text)
     self.assertNotEqual(enc, self.text)
     result = self._ssh_decrypt_text(self.prikey, enc)
     self.assertEqual(result, self.text)