Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples
Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
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
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) Example: Crypt2.GetSignedAttributes method

Demonstrates how to call the GetSignedAttributes method.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoCrypt
    Variant vBdPkcs7
    Handle hoBdPkcs7
    Boolean iSuccess
    Handle hoJson
    Variant vSbJson
    Handle hoSbJson
    Integer i
    Boolean iTryNext
    String sTemp1
    Boolean bTemp1

    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End

    Get Create (RefClass(cComChilkatBinData)) To hoBdPkcs7
    If (Not(IsComObjectCreated(hoBdPkcs7))) Begin
        Send CreateComObject of hoBdPkcs7
    End
    Get ComLoadFile Of hoBdPkcs7 "qa_data/cades/CAdES-T/Signature-C-T-1.p7m" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoBdPkcs7 To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Set ComEmitCompact Of hoJson To False

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbJson
    If (Not(IsComObjectCreated(hoSbJson))) Begin
        Send CreateComObject of hoSbJson
    End
    Move 0 To i
    Move True To iTryNext
    While iTryNext
        Get ComGetSignedAttributes Of hoCrypt i         Get pvComObject of hoBdPkcs7 to vBdPkcs7
vBdPkcs7         Get pvComObject of hoSbJson to vSbJson
vSbJson To bTemp1
        If (bTemp1 = True) Begin
            Get pvComObject of hoSbJson to vSbJson
            Get ComLoadSb Of hoJson vSbJson To iSuccess
            Showln i ": "
            Get ComEmit Of hoJson To sTemp1
            Showln sTemp1
        End
        Else Begin
            Move False To iTryNext
        End

        Move (i + 1) To i
    Loop

    // Sample output:

    // 0: 
    // {
    //   "signedAttributes": [
    //     {
    //       "oid": "1.2.840.113549.1.9.3",
    //       "name": "Content Type"
    //     },
    //     {
    //       "oid": "1.2.840.113549.1.9.5",
    //       "name": "Signing Time"
    //     },
    //     {
    //       "oid": "1.2.840.113549.1.9.4",
    //       "name": "Message Digest"
    //     },
    //     {
    //       "oid": "1.2.840.113549.1.9.16.2.47",
    //       "name": "Signing Certificate V2"
    //     }
    //   ]
    // }


End_Procedure

 

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