47 lines
2.5 KiB
Diff
47 lines
2.5 KiB
Diff
--- browserid/tests/test_m2_monkeypatch.py.orig 2018-10-12 19:47:04.690816753 +0200
|
|
+++ browserid/tests/test_m2_monkeypatch.py 2018-10-12 19:48:32.177899673 +0200
|
|
@@ -41,17 +41,17 @@
|
|
k = _m2.DSA.gen_params(512)
|
|
k.gen_key()
|
|
_m2.dsa_set_pub(k.dsa, k.pub)
|
|
- self.assertRaises(_m2.DSA.DSAError, _m2.dsa_set_pub, k.dsa, "\x00")
|
|
+ self.assertRaises(_m2.DSA.DSAError, _m2.dsa_set_pub, k.dsa, b"\x00")
|
|
_m2.dsa_set_priv(k.dsa, k.priv)
|
|
- self.assertRaises(_m2.DSA.DSAError, _m2.dsa_set_priv, k.dsa, "\x00")
|
|
+ self.assertRaises(_m2.DSA.DSAError, _m2.dsa_set_priv, k.dsa, b"\x00")
|
|
|
|
def test_setting_invalid_data_on_rsa_key(self):
|
|
args = map(int2mpint, (DUMMY_RSA_E, DUMMY_RSA_N, DUMMY_RSA_D))
|
|
k = _m2.RSA.new_key(args)
|
|
- self.assertTrue(k.verify("hello", k.sign("hello")))
|
|
+ self.assertTrue(k.verify(b"hello", k.sign(b"hello")))
|
|
_m2.rsa_set_d(k.rsa, int2mpint(DUMMY_RSA_D))
|
|
- self.assertRaises(_m2.RSA.RSAError, _m2.rsa_set_d, k.rsa, "\x00")
|
|
- self.assertTrue(k.verify("hello", k.sign("hello")))
|
|
+ self.assertRaises(_m2.RSA.RSAError, _m2.rsa_set_d, k.rsa, b"\x00")
|
|
+ self.assertTrue(k.verify(b"hello", k.sign(b"hello")))
|
|
|
|
def test_dsa_signing_works_with_loaded_keys(self):
|
|
d_orig = _m2.DSA.gen_params(512)
|
|
@@ -66,12 +66,12 @@
|
|
self.assertEquals(getattr(d_orig, nm), getattr(d_priv, nm))
|
|
self.assertEquals(d_orig.priv, d_priv.priv)
|
|
# Check that they can all validate signatures from original key.
|
|
- r, s = d_orig.sign("helloworld")
|
|
- self.assertTrue(d_orig.verify("helloworld", r, s))
|
|
- self.assertTrue(d_pub.verify("helloworld", r, s))
|
|
- self.assertTrue(d_priv.verify("helloworld", r, s))
|
|
+ r, s = d_orig.sign(b"helloworld")
|
|
+ self.assertTrue(d_orig.verify(b"helloworld", r, s))
|
|
+ self.assertTrue(d_pub.verify(b"helloworld", r, s))
|
|
+ self.assertTrue(d_priv.verify(b"helloworld", r, s))
|
|
# Check that they can all validate signatures from loaded priv key.
|
|
- r, s = d_priv.sign("helloworld")
|
|
- self.assertTrue(d_orig.verify("helloworld", r, s))
|
|
- self.assertTrue(d_pub.verify("helloworld", r, s))
|
|
- self.assertTrue(d_priv.verify("helloworld", r, s))
|
|
+ r, s = d_priv.sign(b"helloworld")
|
|
+ self.assertTrue(d_orig.verify(b"helloworld", r, s))
|
|
+ self.assertTrue(d_pub.verify(b"helloworld", r, s))
|
|
+ self.assertTrue(d_priv.verify(b"helloworld", r, s))
|