def test_sign_then_encrypt(self, gpg, msg): msg_text = msg.as_string() signed = gpg.sign_email(msg, keyid="*****@*****.**", passphrase="secret") assert gpgmime.is_signed(signed) assert msg.as_string() == msg_text signed_text = signed.as_string() encrypted = gpg.encrypt_email(signed, recipients="*****@*****.**") assert gpgmime.is_encrypted(encrypted) assert not gpgmime.is_signed(encrypted) assert signed.as_string() == signed_text logger.debug("two-step output: %r", encrypted.as_string())
def test_sign_encrypt_onestep(self, gpg, msg): msg_text = msg.as_string() ret = gpg.sign_and_encrypt_email( msg, keyid="*****@*****.**", passphrase="secret", recipients="*****@*****.**" ) assert gpgmime.is_encrypted(ret) assert not gpgmime.is_signed(ret) # Per is_signed's docstring, there # is no way to tell if the message # is also encrypted. assert msg.as_string() == msg_text logger.debug("one-step output: %r", ret.as_string())
def test_sign_verify(gpg, msg): ret = gpg.sign_email(msg, keyid="*****@*****.**", passphrase="secret") assert gpgmime.is_signed(ret) verified = gpg.verify_email(ret) assert verified