//BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), 1 );
/* check signature id can be extracted */
+
+}
+
+void keyring_signature_test( const string &dir )
+{
+ PublicKey key( Pathname(dir) + "public.asc" );
+
{
KeyRingTestReceiver keyring_callbacks;
KeyRingTestSignalReceiver receiver;
BOOST_CHECK_THROW( keyring.readSignatureKeyId(Pathname()), Exception );
TmpFile tmp;
BOOST_CHECK_EQUAL( keyring.readSignatureKeyId(tmp.path()), "" );
+
+ keyring.importKey(key);
+
+ BOOST_CHECK(keyring.verifyFileSignature( Pathname(dir) + "repomd.xml", Pathname(dir) + "repomd.xml.asc"));
+ BOOST_CHECK( ! keyring.verifyFileSignature( Pathname(dir) + "repomd.xml.corrupted", Pathname(dir) + "repomd.xml.asc"));
}
}
test_suite* test= BOOST_TEST_SUITE( "PublicKeyTest" );
test->add(BOOST_PARAM_TEST_CASE( &keyring_test,
(std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE( &keyring_signature_test,
+ (std::string const*)params, params+1));
return test;
}
MIL << "Determining key id if signature " << signature << endl;
// HACK create a tmp keyring with no keys
TmpDir dir(_base_dir, "fake-keyring");
- TmpFile fakeData(_base_dir, "fake-data");
const char* argv[] =
{
"1",
"--homedir",
dir.path().asString().c_str(),
- "--verify",
signature.asString().c_str(),
- fakeData.path().asString().c_str(),
NULL
};