How to use the pgpy.PGPMessage function in PGPy

To help you get started, we’ve selected a few PGPy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SecurityInnovation / PGPy / tests / test_10_exceptions.py View on Github external
def test_decrypt_protected_key(self, rsa_enc, rsa_pub):
        emsg = rsa_pub.encrypt(PGPMessage.new("asdf"))
        with pytest.raises(PGPError):
            rsa_enc.decrypt(emsg)
github SecurityInnovation / PGPy / tests / test_10_exceptions.py View on Github external
def test_decrypt_unencrypted(self):
        msg = PGPMessage.from_file('tests/testdata/messages/message.signed.asc')
        with pytest.raises(PGPError):
            msg.decrypt("Password")
github TheClimateCorporation / python-dpkg / tests / test_dsc.py View on Github external
def test_pgp_validation(self):
        self.assertEqual(None, self.good.pgp_message)
        self.assertEqual(self.signed.source, 'testdeb')
        with pytest.raises(DscBadSignatureError):
            self.badsigned.source_files
        self.assertIsInstance(self.signed.pgp_message, PGPMessage)
github quedexnet / python-api / tests / test_user_stream.py View on Github external
def sign_encrypt(entity, private_key, public_key):
  message = pgpy.PGPMessage.new(json.dumps(entity))
  message |= private_key.sign(message)
  return str(public_key.encrypt(message))
github SecurityInnovation / PGPy / tests / test_10_exceptions.py View on Github external
def test_decrypt_unencrypted_message(self, rsa_sec, recwarn):
        lit = PGPMessage.new('tests/testdata/lit', file=True)
        rsa_sec.decrypt(lit)

        w = recwarn.pop(UserWarning)
        assert str(w.message) == "This message is not encrypted"
        assert w.filename == __file__
github quedexnet / python-api / quedex_api / market_stream.py View on Github external
def process_data(self, message_wrapper):
    clearsigned_message_str = message_wrapper['data']

    clearsigned_message = pgpy.PGPMessage().from_blob(clearsigned_message_str)
    if not self._quedex_key.verify(clearsigned_message):
      self.on_error(Exception('Signature verification failed on message: %s' % clearsigned_message_str))

    self._parse_message(clearsigned_message.message)