Guest User

Untitled

a guest
Feb 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. class testClass(TemplateView):
  2. template_name = 'cryptator/decrypt_test.html'
  3.  
  4. def get_context_data(self, **kwargs):
  5. context = super(testClass, self).get_context_data(**kwargs)
  6. public_read = Public_keys.objects.all().filter(owner="Merkantil")
  7. pwdencsign = Attachment.objects.values_list('file', flat=True).filter(file__endswith=".pwdencsign")
  8. pwdenc = Attachment.objects.values_list('file', flat=True).filter(file__endswith=".pwdenc")
  9. enc = Attachment.objects.values_list('file', flat=True).filter(file__endswith=".enc")
  10. pubtest = public_read[0]
  11. pwdenc_r = pwdenc[0]
  12. pwdencsign_r = pwdencsign[0]
  13. file_pwdenc = "/opt/cryptator/media/%s" % (pwdenc_r)
  14. file_pwdencsign = "/opt/cryptator/media/%s" % (pwdencsign_r)
  15. with open(file_pwdenc) as f:
  16. string_pwdenc = f.read()
  17. with open(file_pwdencsign) as fs:
  18. string_pwdencsign = fs.read()
  19. verify = crypto.verify(pubtest, string_pwdencsign, string_pwdenc, 'sha256')
  20.  
  21. context['verify'] = verify
  22. return context
Add Comment
Please, Sign In to add comment