diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c index 7063e8e5e..118394dca 100644 --- a/programs/pkey/rsa_sign.c +++ b/programs/pkey/rsa_sign.c @@ -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; } diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c index cd29ef8be..6dacdab7a 100644 --- a/programs/pkey/rsa_verify.c +++ b/programs/pkey/rsa_verify.c @@ -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; }