1

I am very new in programming. I need to sign PDF document, the user have more than 1 certificate (I have UserName, password, ID of specific certificate , Serial of specific certificate )

I am trying to understand, the order of methods i need to use and which methods i need to use.

Is it need to be like this?

1.Initialize SAPI Library : SAPIInit

2.Acquire SAPI session handle: SAPIHandleAcquire(SESHandle)

3.Personalize SAPI Session : SAPILogon(SESHandle, username, domain, password)

  1. SAPIConfigurationValueSet

  2. SAPISignatureFieldCreateSign(SESHandle, fileType, filePath, SFS, flags, "")

  3. SAPILogoff(SESHandle)

  4. SAPIHandleRelease(SESHandle)

Jenny A
  • 31
  • 2

1 Answers1

1

The order and methods are fine. These are the parameters that you should pass to the ConfigurationValueSet function:

ConfigurationValueSet(SESHandle, SAPI_ENUM_CONF_ID.SAPI_ENUM_CONF_ID_CERT_SERIAL_ID, SAPI_ENUM_DATA_TYPE.SAPI_ENUM_DATA_TYPE_WSTR, "{CERT SERIAL ID}", 1)
Almog G.
  • 817
  • 7
  • 11
  • Thanks, but i still have a problem. – Jenny A Sep 30 '14 at 08:30
  • I get an error: "Failed to get the default certificate. The user has no valid certificate in the store". My ID has a format like this : "11111111-aa11-1aa1-11aa-11aaa1a1a11a" (1-number, a-letter). My Serial has format like this : "11 11 11 1a 11 11 11 11 11 1a". What i supposed to use, ID or Serial? – Jenny A Sep 30 '14 at 08:42
  • You should use the certificate serial number, and without the inner blank spaces. – Almog G. Sep 30 '14 at 08:58