Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

VB.NET UWP/WinRT Examples

Web API Categories

ASN.1
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks

Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
NTLM
OAuth1
OAuth2
Office365
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(VB.NET UWP/WinRT) Create ICP-Brasil Compliant CMS Signature

Demonstrates how to create a .p7s signature that contains a data file, which in this case is a PDF. The .p7s will be compliant with the ICP-Brazil Digital Signature Standard.

The .p7s file created by this example can be verified at ICP-Brasil Online Verifier

Important: This example requires Chilkat v9.5.0.83 or later.

For more information, see http://www.iti.gov.br/images/repositorio/consulta-publica/encerradas/DOC-ICP-15_-_Versao_2.2_VISAO_GERAL_SOBRE_ASSIN_DIG_NA_ICP-BRASIL_xx-xx-2015.pdf

Chilkat Universal Windows Platform (UWP) / WinRT Downloads

Chilkat for the Universal Windows Platform (UWP)

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim crypt As New Chilkat.Crypt2

' Any type of file can be signed.  It doesn't have to be a PDF.
Dim inFile As String = "qa_data/pdf/helloWorld.pdf"

Dim bd As New Chilkat.BinData
Dim success As Boolean = bd.LoadFile(inFile)
If (success = False) Then
    Debug.WriteLine("Failed to load " & inFile)
    Exit Sub
End If


' We'll be using a certificate w/ private key stored on a smartcard for signing.
Dim cert As New Chilkat.Cert

' If the smartcard or token requires a PIN, we can set it here to avoid the dialog...
cert.SmartCardPin = "000000"

success = cert.LoadFromSmartcard("")
If (success <> True) Then
    Debug.WriteLine(cert.LastErrorText)
    Exit Sub
End If


' Tell the crypt component to use this cert.
success = crypt.SetSigningCert(cert)
If (success <> True) Then
    Debug.WriteLine(crypt.LastErrorText)
    Exit Sub
End If


' Set properties for signing...
crypt.HashAlgorithm = "sha1"

Dim jsonSigningAttrs As New Chilkat.JsonObject
jsonSigningAttrs.UpdateInt("contentType",1)
jsonSigningAttrs.UpdateInt("signingTime",1)
jsonSigningAttrs.UpdateInt("messageDigest",1)

crypt.SigningAttributes = jsonSigningAttrs.Emit()

' The Brazil government validator requires the ASN.1 data to be in "constructed octets" form..
crypt.UncommonOptions = "UseConstructedOctets,OmitAlgorithmIdNull"
crypt.IncludeCertChain = False

' Sign. 
success = Await crypt.OpaqueSignBdAsync(bd)
If (success = False) Then
    Debug.WriteLine(crypt.LastErrorText)
    Exit Sub
End If


' Save to a .p7s
success = bd.WriteFile("qa_output/helloWorld.pdf.p7s")

Debug.WriteLine("Success")

 

© 2000-2020 Chilkat Software, Inc. All Rights Reserved.