def testJustSignature(self): '''Test the verification of data which has been signed but not encrypted''' self._setupKeyring(["key1_private"]) junk = bytearray() junk.append(3) junk.append(0) junk.append(9) MESSAGE = "This is the unencrypted source text we're going to use".encode("utf-8") + bytes(junk) OWNKEYID = self.KEYID_1 self.assertFalse("BEGIN PGP SIGNED MESSAGE".encode("utf-8") in MESSAGE, "Input data shouldn't include PGP prefix") signed = CryptoClient.signData(MESSAGE, OWNKEYID) self.assertTrue(signed, "Signed data shouldn't be blank") self.assertTrue("BEGIN PGP SIGNED MESSAGE".encode("utf-8") in signed, "Signed data should include PGP prefix") retrieved, keyid = CryptoClient.verifySignedData(signed) self.assertEqual(MESSAGE, retrieved, "Retrieved data should be the same as the input") self.assertIsNotNone(keyid, "keyid which signed should not be blank")
def _createPayload(self, recipientKeyId): '''Get the original message, and then sign it with our key''' if self.origParcel: ownKeyId = DbI.getOwnKeyid() return CryptoClient.signData(self.origParcel, ownKeyId)