Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Re: Calculating outSigValueSize

$
0
0

Hi,

 

If you are using PROP_PSENG_SignFormatPKCS7DetachedDigest then you digestValue would be null and you can retrieve that data to sign from the data buffer.

 

My sigGetSigValue looks something like:

 

void DSEngine::sigGetSigValue( PSSigGetSigValueParams params )

{

        if (ASBoolToBool(params->bGetSigValue) == true)

        {

                    std::string data;

                    ASInt32 dataBufferSize = 0;

 

                    if(params->digestValue == NULL)

                    {

                              //Must use own Digest

                              if(params->dataBuffer == NULL)

                              {

                                        AVAlertNote("dataBuffer is NULL");

                                        return;

                              }

 

                              ASUns8* val = new ASUns8[1024];

                              ASInt32 ret;

                              //Get data from buffer

                              while(PSDataBufferEnum(params->dataBuffer, 8, &val, &ret))

                              {

                                        data.append((constchar*)val,ret);

                                        dataBufferSize += ret;

                              }

                              //Sign my message

                              if(SignMessage(( BYTE *)data.c_str(), dataBufferSize,&SignedMessage))

                              {

                                        params->outSigValueData = (ASUns8 *)ASmalloc( SignedMessage.cbData+1);

                                        memcpy( params->outSigValueData, (ASUns8*)SignedMessage.pbData, SignedMessage.cbData);

                                        params->outSigValueSize = SignedMessage.cbData;

                              }

                              else

                              {

                                        AVAlertNote("Not Signend");

                              }

                    }

          }

          else

          {

                    // There's no digest set expected size

                    params->outSigValueSize = 7168;

          }

}

 

Hope this helps,

Magda


Viewing all articles
Browse latest Browse all 10848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>