I am trying to write code to verify some RSA signatures. Signatures were made using the OpenSSL command line tool, using the equivalent of this command line:
openssl dgst -sha1 -sign private_key_file.pem < binary_data_file > sig
I am trying to use libtomcryptfor verification:
http://www.libtom.org/
Here is the calling signature of the RSA validation function in libtomcrypt:
int rsa_verify_hash_ex(
const unsigned char *sig, unsigned long siglen,
const unsigned char *hash, unsigned long hashlen,
int padding,
int hash_idx,
unsigned long saltlen,
int *stat,
rsa_key *key);
This function returns 0 if it works without errors, otherwise it returns an error code. If it works without errors, the output parameter statindicates whether the signature is verified.
: , , , RSA . hash_idx , libtomcrypt; -, : hash_idx = find_hash("sha1")
padding saltlen. padding , , . saltlen?
OpenSSL OpenSSL RSA saltlen. openssl dgst (.. man dgst) .
, :
- ?
- OpenSSL
dgst - , : (stdin)=
( , (stdin)= , StackOverflow: RSA-SHA256 OpenSSL Java ?)
libtomcrypt , pkcs_1_pss_decode(), " PSS-". , , ?
, .
EDIT: , @Jonathan Ben-Avraham, . , :
- 0 , .
- , OpenSSL ,
(stdin)= rsa_verify_hash_ex(), padding LTC_LTC_PKCS_1_V1_5.