some minor changes; refs #8

master
Marc Wäckerlin 14 years ago
parent 44468b3924
commit 1d0ba31114
  1. 21
      openssl-act-engine/src/test_engine.cpp

@ -62,6 +62,7 @@ int main(int argc, char* argv[])
}
}
/*
EVP_PKEY* pk_pub = ENGINE_load_public_key(e, selected_cert->id, NULL, NULL);
RSA* pubkey = EVP_PKEY_get1_RSA(pk_pub);
@ -89,6 +90,26 @@ int main(int argc, char* argv[])
printf("%s",plainbuf);
*/
const char *source = "Dies ist ein Testtext zum Signieren.\n";
int srclen = strlen(source)+1;
char signature[1000];
unsigned int siglen = 0;
EVP_PKEY* pk_priv = ENGINE_load_private_key(e, selected_cert->id, NULL, NULL);
RSA* privkey = EVP_PKEY_get1_RSA(pk_priv);
CHECK(RSA_sign(NID_md5_sha1, (const unsigned char*)source, srclen, (unsigned char*)signature, &siglen, privkey));
printf("Signature-Len: %d\n", siglen);
EVP_PKEY* pk_pub = ENGINE_load_public_key(e, selected_cert->id, NULL, NULL);
RSA* pubkey = EVP_PKEY_get1_RSA(pk_pub);
CHECK(RSA_verify(NID_md5_sha1,(const unsigned char*) source, srclen, (unsigned char*)signature, siglen, pubkey));
CHECK(ENGINE_finish(e));

Loading…
Cancel
Save