mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
Fix RSASSA-PSS example programs
This commit is contained in:
parent
83cdffc437
commit
844a4c0aef
5 changed files with 34 additions and 4 deletions
|
|
@ -101,7 +101,8 @@ int main( int argc, char *argv[] )
|
|||
if( ( ret = pk_parse_keyfile( &pk, argv[1], "" ) ) != 0 )
|
||||
{
|
||||
ret = 1;
|
||||
printf( " failed\n ! Could not open '%s'\n", argv[1] );
|
||||
printf( " failed\n ! Could not read key from '%s'\n", argv[1] );
|
||||
printf( " ! pk_parse_public_keyfile returned %d\n\n", ret );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +113,8 @@ int main( int argc, char *argv[] )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
rsa_set_padding( pk_rsa( pk ), RSA_PKCS_V21, POLARSSL_MD_SHA1 );
|
||||
|
||||
/*
|
||||
* Compute the SHA-1 hash of the input file,
|
||||
* then calculate the RSA signature of the hash.
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
if( ( ret = pk_parse_public_keyfile( &pk, argv[1] ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! pk_parse_public_keyfile returned %d\n\n", ret );
|
||||
printf( " failed\n ! Could not read key from '%s'\n", argv[1] );
|
||||
printf( " ! pk_parse_public_keyfile returned %d\n\n", ret );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +93,8 @@ int main( int argc, char *argv[] )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
rsa_set_padding( pk_rsa( pk ), RSA_PKCS_V21, POLARSSL_MD_SHA1 );
|
||||
|
||||
/*
|
||||
* Extract the RSA signature from the text file
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue