Hello,
I have installed current demo release of PDF-XChange Drivers. When I set digital signature properties (certifacate etc.) manually in printer options, and then print anything, everything works fine an I get signed PDF file. But when I try to do the same things programmatically, no error is displayed, everything looks normal, but I get the file without digital signature.
Here is my code:
Option Explicit
Const SW_MINIMIZE = 11
Private Declare Function ShellExecute Lib "Shell32" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim pFactory As New PXCComLib.CPXCControlEx
Dim pPrinter As PXCComLib.CPXCPrinter
Dim pname As String
Set pPrinter = pFactory.Printer("", "PDF-XChange 4.0 Sample", "<YOUR REG CODE>", "<YOUR DEV CODE>")
pname = pPrinter.Name
With pPrinter
.ResetDefaults
.Option("Save.File") = "c:\testsigned.pdf"
.Option("Save.SaveType") = "Save"
.Option("Save.ShowSaveDialog") = "No"
.Option("Save.WhenExists") = "Overwrite"
'Digital signature
.Option("DigiSig.Enabled") = True
.Option("DigiSig.Store") = "1"
.Option("DigiSig.PFXPath") = "c:\pokus2.pfx"
.Option("DigiSig.PFXPassword") = "PASS888"
.Option("DigiSig.Reason") = "Reason test field"
'Compression off
.Option("Compression.Graphics") = "No"
.Option("Compression.Text") = "No"
.Option("Saver.ShowProgress") = "No"
.ApplyOptions 0
End With
ShellExecute 0, "printto", "c:\test.doc", """" + pname + """", vbNull, SW_MINIMIZE
End Sub
Unsuccessfull test of digital signing in VB6
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
-
- User
- Posts: 664
- Joined: Tue Nov 14, 2006 12:23 pm
Re: Unsuccessfull test of digital signing in VB6
Dont you mean to do this? :.Option("DigiSig.PFXPath") = "c:\pokus2.pfx"
Code: Select all
.Option("DigiSig.PFXFile") = "c:\pokus2.pfx"
HTH
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
Re: Unsuccessfull test of digital signing in VB6
Corwin, thank you very much, it worked.
I wonder why the line .Option("DigiSig.PFXPath") = "c:\pokus2.pfx" does not throw exception.
Would it be possible to incorporate some verification of input values into next build of your product ? For example it may throw exception in the cases of setting non-existing option, setting incorrect value of the option, certifcate file does not exist, incorrect password for certificate, certificate with given Hash not found etc. Lot of developers would strongly welcome it. (And you would not need to answer such a questions )
I have a hash of the installed certificate in the form of hexadecimal numbers separated by spaces. In which form may I set it to DigiSig.Hash option ? Is it possible to use certificate installed in system, when it is password-protected ?
I wonder why the line .Option("DigiSig.PFXPath") = "c:\pokus2.pfx" does not throw exception.
Would it be possible to incorporate some verification of input values into next build of your product ? For example it may throw exception in the cases of setting non-existing option, setting incorrect value of the option, certifcate file does not exist, incorrect password for certificate, certificate with given Hash not found etc. Lot of developers would strongly welcome it. (And you would not need to answer such a questions )
I have a hash of the installed certificate in the form of hexadecimal numbers separated by spaces. In which form may I set it to DigiSig.Hash option ? Is it possible to use certificate installed in system, when it is password-protected ?
-
- User
- Posts: 664
- Joined: Tue Nov 14, 2006 12:23 pm
Re: Unsuccessfull test of digital signing in VB6
Hi aisoft,
In next build if you try to specify wrong option name then you will get an exception. Thanks for pointing that out
First you should convert it to byte array (VT_ARRAY | VT_BYTE) and then write this byte array to Hash option.
In next build if you try to specify wrong option name then you will get an exception. Thanks for pointing that out
Sorry, such possibility will be available only in new build..I have a hash of the installed certificate in the form of hexadecimal numbers separated by spaces. In which form may I set it to DigiSig.Hash option ?
First you should convert it to byte array (VT_ARRAY | VT_BYTE) and then write this byte array to Hash option.
We have not seen any certificate installed in system which was password protected. Are you sure that system storage allows doing such things?Is it possible to use certificate installed in system, when it is password-protected ?
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
Re: Unsuccessfull test of digital signing in VB6
Hello Corwin
Yes, it allows. When you import the certificate with private key from .pfx file into your storage, you can set the private key security to high and choose the password. This password is then required for any use of private key.Corwin - Tracker Sup wrote:We have not seen any certificate installed in system which was password protected. Are you sure that system storage allows doing such things?
-
- Site Admin
- Posts: 3556
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
Re: Unsuccessfull test of digital signing in VB6
Thanks, I see.
And during signing of PDF file you will need to enter your password. There are no way to provide this password via options, and I'm not sure we can/will provide such a feature.
And during signing of PDF file you will need to enter your password. There are no way to provide this password via options, and I'm not sure we can/will provide such a feature.
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
Successfull test of digital signing in VB6
The password entry dialog should be displayed by the layer which computes the signature. To incorporate this feature into the program may be possible, but it's another story.
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
Re: Unsuccessfull test of digital signing in VB6
Hello,
When I make signed PDF, am I able to detect whether the signing proces was succesfull and the resulting PDF is signed ?
When I make signed PDF, am I able to detect whether the signing proces was succesfull and the resulting PDF is signed ?
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Unsuccessfull test of digital signing in VB6
There were comments in this topic that were for the end user Viewer, but in one of my posts I moved I had an answer to aisoft, hence this post.
aisoft,
This is not possible with the current builds. I will request an answer from the development team as to if and when it will be possible.
Regards,
Stefan
aisoft,
This is not possible with the current builds. I will request an answer from the development team as to if and when it will be possible.
Regards,
Stefan
-
- User
- Posts: 20
- Joined: Fri Jul 24, 2009 1:59 pm
Re: Unsuccessfull test of digital signing in VB6
Hello Stefan, did you get an answer for the question above ?
-
- Site Admin
- Posts: 3556
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
Re: Unsuccessfull test of digital signing in VB6
No, via Driver API SDK you can only be notified if file was saved, if there were issues signing the document, the document will be created without a signature.
HTH
HTH
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.