Beispiel #1
0
 def test_valid_signature(self):
     signing_key = SigObj.generate_signing_key()
     pub_key = signing.generate_pubkey(signing_key)
     temp = SignedObject({"PublicKey": pub_key})
     # test valid signature
     temp.sign_object(signing_key)
     self.assertTrue(temp.is_valid("valid"))
Beispiel #2
0
    def test_is_valid(self):
        # Verify that is_valid only returns true if working with a valid
        # Signed Object
        # test a valid signature
        temp = SignedObject({"TestSignatureDictKey": "test"},
                            "TestSignatureDictKey")
        signing_key = generate_private_key()
        temp.sign_object(signing_key)
        self.assertTrue(temp.is_valid("unused"))

        # test OriginatorID
        ogid = temp.OriginatorID
        self.assertTrue(temp.verify_signature(ogid))

        # test invalid OriginatorID
        self.assertFalse(temp.verify_signature("invalid"))