it works; closes #8

This commit is contained in:
Marc Wäckerlin
2011-01-13 07:08:40 +00:00
parent 1d0ba31114
commit cd84f2f7fe
22 changed files with 638 additions and 207 deletions

View File

@@ -351,13 +351,15 @@ int SecureTokenEngine::rsa_sign(int type, const unsigned char *msg, unsigned int
int SecureTokenEngine::rsa_verify(int type, const unsigned char *msg, unsigned int msglen, unsigned char *signature, unsigned int siglen, const CardKey* ck)
{
bool ssl = (type == NID_md5_sha1);
if(ck == NULL)
{
ACT_TRACE("SecureTokenEngine::rsa_verify: No CardKey given\n");
return 0;
}
act::IToken* token = ck->getKey()->GetToken();
act::ITokenKey* key = ck->getKey();
act::IToken* token = key->GetToken();
SecOpGuard guard(token);
act::Synchronize lock(*token);
@@ -365,9 +367,12 @@ int SecureTokenEngine::rsa_verify(int type, const unsigned char *msg, unsigned i
act::Blob _signature(signature, signature+siglen);
bool sig_ok = false;
if(ssl)
key->SetParam(act::HASH, "DummyHash");
try
{
act::Algorithm alg(ck->getKey(), act::VERIFY, _signature);
act::Algorithm alg(key, act::VERIFY, _signature);
alg << _plaintext << act::final;
sig_ok = alg.GetStatus() == act::SIGNATURE_OK;
}

View File

@@ -31,12 +31,14 @@ int main(int argc, char* argv[])
int res(-1);
// Parameters to set for the dynamic loader
CHECK(ENGINE_ctrl_cmd_string(e, "SO_PATH", "./libengine_act.so", 0));
CHECK(ENGINE_ctrl_cmd_string(e, "SO_PATH", "./.libs/libengine_act.so", 0));
CHECK(ENGINE_ctrl_cmd_string(e, "ID", "act", 0));
CHECK(ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0));
// Now actually load the SecureToken engine.
CHECK(ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0));
CHECK(ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)
|| ENGINE_ctrl_cmd_string(e, "SO_PATH", "./src/.libs/libengine_act.so", 0)
&& ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0));
// Following control commands go to the SecureToken engine rather than the dynamic loader