Visual Studio 2005 - .NET 2.0
NCryptoki.dll <span data-scayt_word="versione" data-scaytid="873" style="background-color: rgb(255, 255, 255);">versione 1.5.3.1
NDigitSign.dll <span data-scayt_word="versione" data-scaytid="976" style="background-color: rgb(255, 255, 255);">versione 1.3.1.1
NCryptoMngd.dll <span data-scayt_word="versione" data-scaytid="1079" style="background-color: rgb(255, 255, 255);">versione 1.1.2.1
NSCAPI.dll <span data-scayt_word="versione" data-scaytid="1168" style="background-color: rgb(255, 255, 255);">versione 1.2.1.2
itextsharp.dll <span data-scayt_word="versione" data-scaytid="1275" style="background-color: rgb(255, 255, 255);">versione 5.0.5.0
BouncyCastle.Crypto.dll <span data-scayt_word="versione" data-scaytid="1367" style="background-color: rgb(255, 255, 255);">versione 1.7.4675.27319
La <span data-scayt_word="sola" data-scaytid="1570">sola firma <span data-scayt_word="dei" data-scaytid="1594">dei <span data-scayt_word="documenti" data-scaytid="1595">documenti <span data-scayt_word="funziona" data-scaytid="1622">funziona <span data-scayt_word="correttamente" data-scaytid="1651">correttamente. <span data-scayt_word="Quando" data-scaytid="1551">Quando <span data-scayt_word="invece" data-scaytid="1683">invece <span data-scayt_word="tento" data-scaytid="705" style="background-color: rgb(255, 255, 255);">tento <span data-scayt_word="di" data-scaytid="727" style="background-color: rgb(255, 255, 255);">di <span data-scayt_word="firmare" data-scaytid="821" style="background-color: rgb(255, 255, 255);">firmare e <span data-scayt_word="marcare" data-scaytid="783" style="background-color: rgb(255, 255, 255);">marcare <span data-scayt_word="temporalmente" data-scaytid="1753">temporalmente <span data-scayt_word="ottengo" data-scaytid="21" style="background-color: rgb(255, 255, 255);">ottengo <span data-scayt_word="il" data-scaytid="858" style="background-color: rgb(255, 255, 255);">il <span data-scayt_word="seguente" data-scaytid="859" style="background-color: rgb(255, 255, 255);">seguente <span data-scayt_word="errore" data-scaytid="860" style="background-color: rgb(255, 255, 255);">errore:
malformed timestamp response: System.ArgumentException: Unknown object in '<span data-scayt_word="TimeStampResp" data-scaytid="2" style="background-color: rgb(255, 255, 255);">TimeStampResp' factory: Org.BouncyCastle.Asn1.DerUnknownTag
in Org.BouncyCastle.Asn1.Tsp.TimeStampResp.GetInstance(Object o)
in Org.BouncyCastle.Tsp.TimeStampResponse.readTimeStampResp(<span data-scayt_word="Asn1InputStream" data-scaytid="3">Asn1InputStream input)
<span data-scayt_word="Questo" data-scaytid="395">Questo <span data-scayt_word="è" data-scaytid="422">è <span data-scayt_word="il" data-scaytid="1487">il <span data-scayt_word="codice" data-scaytid="423">codice <span data-scayt_word="di" data-scaytid="1461">di <span data-scayt_word="esempio" data-scaytid="424">esempio <span data-scayt_word="che" data-scaytid="425">che <span data-scayt_word="uso" data-scaytid="426">uso per <span data-scayt_word="firmare" data-scaytid="427">firmare e <span data-scayt_word="marcare" data-scaytid="428">marcare un <span data-scayt_word="documento" data-scaytid="429">documento:
Dim <span data-scayt_word="cfgInput" data-scaytid="626">cfgInput as string = "prova.pdf"
Dim <span data-scayt_word="cfgOutput" data-scaytid="627">cfgOutput as string = "prova.pdf.p7m.m7m"
Dim <span data-scayt_word="cfgPKCS" data-scaytid="628">cfgPKCS as string = "bit4ipki.dll"
Dim <span data-scayt_word="iSlotSel" data-scaytid="629">iSlotSel as integer = 0
Dim <span data-scayt_word="cfgPIN" data-scaytid="630">cfgPIN as string = "12345678"
' Test <span data-scayt_word="TS" data-scaytid="631">TS
Dim <span data-scayt_word="cfgTSUrl" data-scaytid="632">cfgTSUrl as string = "https://portal.actalis.it/<span data-scayt_word="tsa" data-scaytid="633">tsa<span data-scayt_word="/FrontEnd" data-scaytid="1013">/<span data-scayt_word="FrontEnd" data-scaytid="634">FrontEnd"
Dim <span data-scayt_word="cfgTSuser" data-scaytid="635">cfgTSuser as string = "<span data-scayt_word="xxxx" data-scaytid="636">xxxx"
Dim <span data-scayt_word="cfgTSpwd" data-scaytid="637">cfgTSpwd as string = "<span data-scayt_word="yyyy" data-scaytid="638">yyyy"
' Test <span data-scayt_word="TS" data-scaytid="639">TS con proxy
Dim <span data-scayt_word="cfgProxyHost" data-scaytid="640">cfgProxyHost as string = "proxy-server"
Dim <span data-scayt_word="cfgProxyPort" data-scaytid="641">cfgProxyPort as integer = 3128
Dim <span data-scayt_word="cfgProxyUser" data-scaytid="642">cfgProxyUser as string = "<span data-scayt_word="aaaa" data-scaytid="643">aaaa"
Dim <span data-scayt_word="cfgProxyPwd" data-scaytid="644">cfgProxyPwd as string = "<span data-scayt_word="bbbb" data-scaytid="645">bbbb"
<span data-scayt_word="dsign" data-scaytid="576">dsign = New <span data-scayt_word="DigitalSigner" data-scaytid="577">DigitalSigner(<span data-scayt_word="cfgPKCS" data-scaytid="578">cfgPKCS)
dsign.OpenSession(<span data-scayt_word="iSlotSel" data-scaytid="579">iSlotSel)
dsign.Login(<span data-scayt_word="cfgPIN" data-scaytid="580">cfgPIN)
Dim <span data-scayt_word="sel" data-scaytid="581">sel = New <span data-scayt_word="QualifiedCertificateSelector" data-scaytid="583">QualifiedCertificateSelector
Dim <span data-scayt_word="tsa" data-scaytid="584">tsa As <span data-scayt_word="TSAClient" data-scaytid="588">TSAClient = Nothing
If <span data-scayt_word="cfgTSurl" data-scaytid="591">cfgTSurl <> "" Then
If <span data-scayt_word="cfgProxyHost" data-scaytid="594">cfgProxyHost <> "" And <span data-scayt_word="cfgProxyPort" data-scaytid="596">cfgProxyPort > 0 Then
Dim pr As New <span data-scayt_word="WebProxy" data-scaytid="598">WebProxy(<span data-scayt_word="cfgProxyHost" data-scaytid="595">cfgProxyHost, <span data-scayt_word="cfgProxyPort" data-scaytid="597">cfgProxyPort)
If <span data-scayt_word="cfgProxyUser" data-scaytid="599">cfgProxyUser <> "" Then pr.Credentials = New <span data-scayt_word="NetworkCredential" data-scaytid="601">NetworkCredential(<span data-scayt_word="cfgProxyUser" data-scaytid="600">cfgProxyUser, <span data-scayt_word="cfgProxyPwd" data-scaytid="602">cfgProxyPwd)
TSAClient.Proxy = pr
End If
If <span data-scayt_word="cfgTSuser" data-scaytid="603">cfgTSuser = "" Then
<span data-scayt_word="tsa" data-scaytid="585">tsa = New <span data-scayt_word="TSAClient" data-scaytid="589">TSAClient(<span data-scayt_word="cfgTSurl" data-scaytid="592">cfgTSurl)
Else
<span data-scayt_word="tsa" data-scaytid="586">tsa = New <span data-scayt_word="TSAClient" data-scaytid="590">TSAClient(<span data-scayt_word="cfgTSurl" data-scaytid="593">cfgTSurl, <span data-scayt_word="cfgTSuser" data-scaytid="604">cfgTSuser, <span data-scayt_word="cfgTSpwd" data-scaytid="605">cfgTSpwd)
End If
End If
dsign.CAdES = True
dsign.Multisignature = false
dsign.AddCACertificate = True
dsign.Detached = False
dsign.TsaClient = <span data-scayt_word="tsa" data-scaytid="587">tsa
Dim <span data-scayt_word="sd" data-scaytid="606">sd As <span data-scayt_word="SignedDocument" data-scaytid="607">SignedDocument = dsign.Sign(data, <span data-scayt_word="sel" data-scaytid="582">sel)
Dim <span data-scayt_word="signedData" data-scaytid="608">signedData(sd.ToByteArray().Length) As Byte
<span data-scayt_word="signedData" data-scaytid="609">signedData = sd.ToByteArray
dsign.Logout()
dsign.CloseSession()
dsign.Finalize()
File.Delete(<span data-scayt_word="cfgOutput" data-scaytid="611">cfgOutput)
Dim <span data-scayt_word="fso" data-scaytid="613">fso As New <span data-scayt_word="FileStream" data-scaytid="614">FileStream(<span data-scayt_word="cfgOutput" data-scaytid="612">cfgOutput, FileMode.CreateNew)
fso.Write(<span data-scayt_word="signedData" data-scaytid="610">signedData, 0, <span data-scayt_word="CInt" data-scaytid="615">CInt(signedData.Length))
fso.Close()