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
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
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
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
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']
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']