Unable to specify Digital Certificate
Posted: Fri Dec 12, 2014 11:12 am
Hi there
I am attempting to use the V4 API SDK to digitally sign newly created PDF files via the code snippet below in the context of a successfully created instance:
m_pPrinter->ResetDefaults();
m_pPrinter->Option[L"Save.SaveType"] = L"Save";
m_pPrinter->Option[L"Save.ShowSaveDialog"] = L"No";
m_pPrinter->Option[L"Save.File"] = L"test.pdf";
m_pPrinter->Option[L"Save.WhenExists"] = L"Overwrite";
m_pPrinter->Option[L"Save.RunApp"] = FALSE;
m_pPrinter->Option[L"Overlay.Enabled"] = FALSE;
m_pPrinter->Option[L"Compression.Graphics"] = TRUE;
m_pPrinter->Option[L"Compression.Text"] = TRUE;
m_pPrinter->Option[L"Fonts.EmbedAll"] = FALSE;
m_pPrinter->Option[L"Saver.ShowProgress"] = FALSE;
m_pPrinter->Option[L"Digisig.Enabled"] = TRUE;
const char *hash="\xa2\xaa\xa1\x4e\xca\x9d\x3c\xee\xf1\x2b\x6b\xf4\x2f\x4f\x6c\x86\x0d\x5e\xf3\xf1";
m_pPrinter->Option[L"Digisig.Hash"] = hash;
m_pPrinter->ApplyOptions(0);
The problem I'm having is that the "Digisig.Hash" value is specified in the help as 'Binary', and it's not clear to me how such values should be presented to the API. Presumably you must specify which certificate you want to use by specifying its hash value, by which I think you mean the Thumbprint value as specified against the key in the Windows Certificate Manager. That is a 20-byte binary value, so no standard integer formats are big enough - you can see I've tried presenting it as a binary string, but that also doesn't seem to work.
What am I doing wrong here?
Thanks
I am attempting to use the V4 API SDK to digitally sign newly created PDF files via the code snippet below in the context of a successfully created instance:
m_pPrinter->ResetDefaults();
m_pPrinter->Option[L"Save.SaveType"] = L"Save";
m_pPrinter->Option[L"Save.ShowSaveDialog"] = L"No";
m_pPrinter->Option[L"Save.File"] = L"test.pdf";
m_pPrinter->Option[L"Save.WhenExists"] = L"Overwrite";
m_pPrinter->Option[L"Save.RunApp"] = FALSE;
m_pPrinter->Option[L"Overlay.Enabled"] = FALSE;
m_pPrinter->Option[L"Compression.Graphics"] = TRUE;
m_pPrinter->Option[L"Compression.Text"] = TRUE;
m_pPrinter->Option[L"Fonts.EmbedAll"] = FALSE;
m_pPrinter->Option[L"Saver.ShowProgress"] = FALSE;
m_pPrinter->Option[L"Digisig.Enabled"] = TRUE;
const char *hash="\xa2\xaa\xa1\x4e\xca\x9d\x3c\xee\xf1\x2b\x6b\xf4\x2f\x4f\x6c\x86\x0d\x5e\xf3\xf1";
m_pPrinter->Option[L"Digisig.Hash"] = hash;
m_pPrinter->ApplyOptions(0);
The problem I'm having is that the "Digisig.Hash" value is specified in the help as 'Binary', and it's not clear to me how such values should be presented to the API. Presumably you must specify which certificate you want to use by specifying its hash value, by which I think you mean the Thumbprint value as specified against the key in the Windows Certificate Manager. That is a 20-byte binary value, so no standard integer formats are big enough - you can see I've tried presenting it as a binary string, but that also doesn't seem to work.
What am I doing wrong here?
Thanks