- Added rsa_check_privkey() check to rsa_sign

This commit is contained in:
Paul Bakker 2012-09-27 13:19:22 +00:00
parent db2509c9cd
commit 5ef9db2ae3
2 changed files with 10 additions and 2 deletions

View File

@ -99,6 +99,14 @@ int main( int argc, char *argv[] )
fclose( f );
printf( "\n . Checking the private key" );
fflush( stdout );
if( ( ret = rsa_check_privkey( &rsa ) ) != 0 )
{
printf( " failed\n ! rsa_check_privkey failed with -0x%0x\n", -ret );
goto exit;
}
/*
* Compute the SHA-1 hash of the input file,
* then calculate the RSA signature of the hash.
@ -115,7 +123,7 @@ int main( int argc, char *argv[] )
if( ( ret = rsa_pkcs1_sign( &rsa, NULL, NULL, RSA_PRIVATE, SIG_RSA_SHA1,
20, hash, buf ) ) != 0 )
{
printf( " failed\n ! rsa_pkcs1_sign returned %d\n\n", ret );
printf( " failed\n ! rsa_pkcs1_sign returned -0x%0x\n\n", -ret );
goto exit;
}

View File

@ -134,7 +134,7 @@ int main( int argc, char *argv[] )
if( ( ret = rsa_pkcs1_verify( &rsa, RSA_PUBLIC, SIG_RSA_SHA1,
20, hash, buf ) ) != 0 )
{
printf( " failed\n ! rsa_pkcs1_verify returned %d\n\n", ret );
printf( " failed\n ! rsa_pkcs1_verify returned -0x%0x\n\n", -ret );
goto exit;
}