<link>http://ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Re: How select certificate for signing a PDF Thank you Ugo, I have overlooked the example file SimpleCertificateSelector.cs

Based on your example I created my own selector which returns the first certificate of the slot "slotname":

    Class SimpleCertificateSelector2
        Implements ICertificateSelector

        Public Function [Select](ByVal session As Session) As Certificate Implements ICertificateSelector.Select

            Dim template As New CryptokiCollection()
            template = New CryptokiCollection()
            template.Add(New ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_CERTIFICATE))
            template.Add(New ObjectAttribute(ObjectAttribute.CKA_CERTIFICATE_TYPE, NCryptoki.X509Certificate.CKC_X_509))
            template.Add(New ObjectAttribute(ObjectAttribute.CKA_LABEL, "slotname"))
            Dim objs As CryptokiCollection = session.Objects.Find(template, 1)
            If objs.Count = 0 Then Throw New Exception
            Return DirectCast(objs.Item(0), Certificate)

        End Function
    End Class

 

Thanks for the great support, great examples and great software smiley.

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=101~-1#post474 Thomas http://ncryptoki.com/Forums/Thread.aspx?pageid= Wed, 08 May 2013 17:57:23 GMT Re: How select certificate for signing a PDF You can see in the example folder. There is a file SimpleCertificateSelector that implements the interface ICertificateSelector.

Following such template you can write your own CertificateSelector following your requirements.

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=101~-1#post471 Thomas http://ncryptoki.com/Forums/Thread.aspx?pageid= Tue, 07 May 2013 17:10:38 GMT
How select certificate for signing a PDF Hi

I have created a simple test appplication for signing a PDF based on the FullTestNDigitSign example.

The PDF is signed with

pdfSigner.SignPDFFile([input file], selector, [output file])

Selector is defined as

Dim selector As ICertificateSelector

selector = New SimpleCertificateSelector()

In my case (SafeNet HSM) when running the pdfSigner.SignPDFFile command, a pop-up window opens where I can select the certificate I want  to use to sign the PDF.

My question: I have only one certificate in the slot. I want that this certififate is selected automatically, without user interaction. How can I do this?

Many thanks

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=101~-1#post470 Thomas http://ncryptoki.com/Forums/Thread.aspx?pageid= Mon, 06 May 2013 17:55:33 GMT