CreaSign

Verify a Signature on Files

To verify a signature on a document that contains references to external files, follow these steps:

  1. Load the XML document.
  2. Create a new CreaSignLite object.
  3. Call the Verify method and supply the rootPath parameter that identifies the location of the external files.
' Create CreaSignLite
Set csLite=CreateObject("CreaSignClientIE.CreaSignLite")  
'With CreaSignLite use: CreaSignLite.CreaSignLite

fileToVerify = "files/signedDataAndVis.xml"
if WScript.Arguments.Count>0 then fileToVerify=WScript.Arguments(0)


Set data=CreateObject("CreaSignClientIE.Data")
data.Load fileToVerify

Set vr = csLite.Verify(data, 0,"","files\")

PrintVerifyResult vr

Sub PrintVerifyResult(vr)
    WScript.Echo "Signature valid : " & vr.ok
    if vr.OK Then 
    WScript.Echo "Signature is valid"
    else
    WScript.Echo "Signature is invalid"
    WScript.Echo "Error message: " & vr.ErrorMessage 
    End If

    if not (vr.Signer is Nothing) Then PrintSigner vr.Signer

End Sub

Sub PrintSigner(s)
  WScript.Echo "Signer:"
  WScript.Echo "  Name: " & s.DisplayName
  WScript.Echo "  Email: " & s.Email
  WScript.Echo "  Certificate issuer : " & s.IssuerName
  WScript.Echo "  Certificate is valid until " & s.ValidNotAfter
End Sub


Send comments on this topic.

(c) CREA 2002-2007 www.creasign.si