Exemplo n.º 1
0
 def test_bad_passphrase(self, bilateral):
     # bad sender passphrase, cannot sign
     id1 = GPGMIME(bilateral['gpg1'], default_key=(sender, 'wrong'))
     assert id1.sign(msg)[0] is None
     assert id1.encrypt(msg, sign=True)[0] is None
     # bad receiver passphrase, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev)[0]
     assert enc and id1.decrypt(enc)[0] is None
Exemplo n.º 2
0
 def test_bad_defkey(self,bilateral):
     # bad sender passphrase, cannot sign
     id1 = GPGMIME(bilateral['gpg1'],default_key=receiver)
     with raises(KeyMissingError): id1.sign(msgrev)
     with raises(KeyMissingError): id1.encrypt(msgrev,sign=True)
     # bad receiver key, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev,toself=False)[0]
     assert enc and id1.decrypt(enc)[0] is None
Exemplo n.º 3
0
 def test_bad_passphrase(self,bilateral):
     # bad sender passphrase, cannot sign
     id1 = GPGMIME(bilateral['gpg1'],default_key=(sender,'wrong'))
     assert id1.sign(msg)[0] is None
     assert id1.encrypt(msg,sign=True)[0] is None
     # bad receiver passphrase, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev)[0]
     assert enc and id1.decrypt(enc)[0] is None
Exemplo n.º 4
0
 def test_bad_defkey(self, bilateral):
     # bad sender passphrase, cannot sign
     id1 = GPGMIME(bilateral['gpg1'], default_key=receiver)
     with raises(KeyMissingError):
         id1.sign(msgrev)
     with raises(KeyMissingError):
         id1.encrypt(msgrev, sign=True)
     # bad receiver key, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev, toself=False)[0]
     assert enc and id1.decrypt(enc)[0] is None
Exemplo n.º 5
0
 def test_no_defkey(self, bilateral):
     # missing defkey, cannot sign
     id1 = GPGMIME(bilateral['gpg1'])
     assert id1.sign(msg)[0] is None
     assert id1.encrypt(msg, sign=True)[0] is None
     # no receiver key, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev)[0]
     assert enc
     mail, valid, result = id1.decrypt(enc)
     assert mail is None and not valid and not result['signed']
Exemplo n.º 6
0
 def test_no_defkey(self,bilateral):
     # missing defkey, cannot sign
     id1 = GPGMIME(bilateral['gpg1'])
     assert id1.sign(msg)[0] is None
     assert id1.encrypt(msg,sign=True)[0] is None
     # no receiver key, cannot decrypt
     enc = bilateral['id2'].encrypt(msgrev)[0]
     assert enc
     mail, valid, result = id1.decrypt(enc)
     assert mail is None and not valid and not result['signed']