def test_Signed(self): msg = crypto.b64(crypto.generateRandom(1024)) sig = crypto.Signed(msg) sig.sign(self.priv, self.cert) inner = crypto.JSONloads(sig.SignedData) self.assertEqual(msg, inner.Data) self.assertTrue(sig.verify(True)) # TODO: unit tests for CAs sigj = crypto.JSONdumps(sig) sigjl = crypto.JSONloads(sigj) self.assertTrue(sig == sigjl)
def deColon(b): return crypto.b64("".join([chr(int(x, 16)) for x in b.split(":")]))