Programmatically Get Status and Certificate for Digital Signature in web form - InfoPath Dev
in

InfoPath Dev

Programmatically Get Status and Certificate for Digital Signature in web form

Last post 12-16-2009 05:41 AM by Yannis C. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 12-16-2009 05:41 AM

    Programmatically Get Status and Certificate for Digital Signature in web form

    Hello. I'm trying to get Digital Signature data (Status, Certificate, Comment) into text fields.
    Im trying to do this by using the Singature class http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.signature.aspx.
    The code works on client (preview) but not in the browser. (Log files exception message: The method or operation is not implemented.)
    A strange thing is that I had to change the path of reference Microsoft.Office.InfoPath.dll to C:\Program Files\Microsoft Office Servers\12.0\Bin\Microsoft.Office.InfoPath.dll 
    (There are several dll files with the same name on the server but only this one includes the Signature Class)
    I guess the form is not using the correct dll file when published.

    Any ideas on how make this work or an alternative on how to retrieve the data?

    My VB code is the following:

    Imports Microsoft.Office.InfoPath
    Imports System
    Imports System.Xml
    Imports System.Xml.XPath
    Imports System.Object
    Imports Microsoft.VisualBasic.Constants
    Imports Microsoft.Office.InfoPath.Signature
    Namespace RetreiveDigitalSignature3

    Public Class FormCode
    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
    AddHandler DirectCast(EventManager.ControlEvents("CTRL5_5"), ButtonEvent).Clicked, AddressOf CTRL5_5_ClickedEnd Sub
    Public Sub CTRL5_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

     

    ' Get signature.
    Dim mySignature As Signature = Me.SignedDataBlocks(0).Signatures(0)
    ' Get status of signature.
    Dim sigStatus As String = mySignature.Status.ToString()
    ' Get comment.
    Dim signatureComment As String = mySignature.Comment
    ' Get certificate used to sign with.
    Dim signatureCertificate As Certificate = mySignature.Certificate

    Dim mainNav As XPathNavigator = MainDataSource.CreateNavigator()
    mainNav.SelectSingleNode("/my:myFields/my:field1", Me.NamespaceManager()).SetValue(sigStatus)
    mainNav.SelectSingleNode(
    "/my:myFields/my:field2", Me.NamespaceManager()).SetValue(signatureComment)
    mainNav.SelectSingleNode(
    "/my:myFields/my:field3", Me.NamespaceManager()).SetValue(signatureCertificate.IssuedTo)

    End Sub
    End Class
    End
    Namespace

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.