On Montag, 12. August 2002 04:03, Michael Mi wrote:
> Hi, there,
>
> I met some problem on OpenSSL library.
>
> I used following statments to make signature.
>
> ...
> dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,bio_err);
> ...
> DSA_generate_key(dsa);
> ...
> r = DSA_sign(0, str1, 20, sig, &siglen, dsa);
>
> the result r equals to 1, that means good. But when I tried to sign some
> longer string, such as a string length of 21, the result is always bad. ( r
> equals to zero)
DSA_sign() expects the result of the SHA-1 hash alg. ( which is
20 bytes long ). You should hash ( with SHA-1 ) the string and
then sign the hash with DSA_sign() ( or use the EVP_Sign{Init|Update|Final}
functions ).
Nils
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]