I have been trying to sign a message with message recovery using RSA. I used (slightly
modified) code from SignatureValidate() in validat2.cpp (release 5.1):

    // std::string privateKey declared elsewhere
    StringSource privateKeySource(privateKey, true, new HexDecoder);
    RSASSA_PKCS1v15_SHA_Signer signer(privateKeySource);

    // std::string publicKey declared elsewhere
    StringSource publicKeySource(publicKey, true, new HexDecoder);
    RSASSA_PKCS1v15_SHA_Verifier verifier(publicKeySource);

    SecByteBlock signature(signer.MaxSignatureLength());

    const byte *message = (byte *)"test message";
    const int messageLength = 12;

    int signatureLength = signer.SignMessageWithRecovery(
        randomNumberPool, message, messageLength, NULL, 0, signature);

    SecByteBlock 
recovered(signer.MaxRecoverableLengthFromSignatureLength(signatureLength));
    DecodingResult result = verifier.RecoverMessage(
        recovered, NULL, 0, signature, signatureLength);


I get the following exception:
TF_SignerBase: this algorithm does not support message recovery or the key is too short

My keys are 1024 bits. That should be long enough. So it looks like signing with 
message
recovery is not supported with RSA signers (when I try MD2 or MD5 instead of SHA, I get
compilation errors). 

I would like to know why signing with message recovery is not supported and is there 
any way
around this.


Thanks,

Olga

=====
Olga Sayenko
http://www.cs.uic.edu/~osayenko
Department of Computer Science
University of Illinois at Chicago

Reply via email to