Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode 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
Bounced Email
Box
CAdES
CSR
CSV
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
MS Storage Providers
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
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) ScMinidriver - Get Smartcard Properties

See more ScMinidriver Examples

Gets information about the smart card currently inserted in the reader (or USB token).

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoScmd
    String sReaderName
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    String sStrVal
    Integer iBytesAvailable
    Integer iContainersAvailable
    Integer iMaxKeyContainers
    Boolean iCapabilitiesFCertificateCompression
    Boolean iCapabilitiesFKeyGen
    Integer iKeySizesMinimumBitlen
    Integer iKeySizesDefaultBitlen
    Integer iKeySizesMaximumBitlen
    Integer iKeySizesIncrementalBitlen
    Boolean iReadOnly
    String sCacheMode
    Boolean iSupportsWinX509Enrollment
    String sGuid
    String sSerial
    String sPinUserType
    String sPinUserPurpose
    String sPinUserCachePolicy
    String sPinUserPolicyInfo
    String sPinUserFlags
    Boolean iPinUserAcceptPlainTextPin
    Boolean iPinUserGenerateSessionPin
    String sPinAdminType
    String sPinAdminPurpose
    String sPinAdminCachePolicy
    String sPinAdminPolicyInfo
    String sPinAdminFlags
    String sPinRole3Type
    String sPinRole3Purpose
    String sPinRole3CachePolicy
    String sPinRole3PolicyInfo
    String sPinRole3Flags
    Boolean iPinRole3AcceptPlainTextPin
    Boolean iPinRole3GenerateSessionPin
    String sPinRole4Type
    String sPinRole4Purpose
    String sPinRole4CachePolicy
    String sPinRole4PolicyInfo
    String sPinRole4Flags
    Boolean iPinRole4AcceptPlainTextPin
    Boolean iPinRole4GenerateSessionPin
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatScMinidriver)) To hoScmd
    If (Not(IsComObjectCreated(hoScmd))) Begin
        Send CreateComObject of hoScmd
    End

    // Reader names (smart card readers or USB tokens) can be discovered
    // via PCSC List Readers or PCSC Find Smart Cards
    Move "Alcor Micro USB Smart Card Reader 0" To sReaderName
    Get ComAcquireContext Of hoScmd sReaderName To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoScmd 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 pvComObject of hoJson to vJson
    Get ComGetCardProperties Of hoScmd vJson To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoScmd To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1

    // Here is sample output:
    // See below for sample code to parse the JSON.
    // 
    // NOTE: Not all smart cards support all properties.
    // The GetCardProperties method will return information for all properties supported by the card.

    // {
    //   "bytesAvailable": 74752,
    //   "containersAvailable": 18,
    //   "maxKeyContainers": 20,
    //   "capabilities": {
    //     "fCertificateCompression": false,
    //     "fKeyGen": true
    //   },
    //   "keySizes": {
    //     "minimumBitlen": 2048,
    //     "defaultBitlen": 2048,
    //     "maximumBitlen": 4096,
    //     "incrementalBitlen": 1024
    //   },
    //   "readOnly": false,
    //   "cacheMode": "global",
    //   "supportsWinX509Enrollment": true,
    //   "guid": "1201803d-03e6-772a-3d80-0112e6032a77",
    //   "serial": "e6032a773d800112e6032a77",
    //   "pins": [
    //     "user",
    //     "admin",
    //     "role3",
    //     "role4"
    //   ],
    //   "pin": {
    //     "user": {
    //       "type": "regular",
    //       "purpose": "primaryCard",
    //       "changePermission": [
    //         "user"
    //       ],
    //       "unblockPermission": [
    //         "admin"
    //       ],
    //       "cachePolicy": "normal",
    //       "policyInfo": "00000000",
    //       "flags": "00000000",
    //       "acceptPlainTextPin": true,
    //       "generateSessionPin": false
    //     },
    //     "admin": {
    //       "type": "challenge/response",
    //       "purpose": "administrator",
    //       "changePermission": [
    //         "admin"
    //       ],
    //       "cachePolicy": "normal",
    //       "policyInfo": "00000000",
    //       "flags": "00000000"
    //     },
    //     "role3": {
    //       "type": "regular",
    //       "purpose": "digitalSignature",
    //       "changePermission": [
    //         "role3"
    //       ],
    //       "unblockPermission": [
    //         "role4"
    //       ],
    //       "cachePolicy": "alwaysPrompt",
    //       "policyInfo": "00000000",
    //       "flags": "00000000",
    //       "acceptPlainTextPin": true,
    //       "generateSessionPin": false
    //     },
    //     "role4": {
    //       "type": "regular",
    //       "purpose": "unblockOnly",
    //       "changePermission": [
    //         "role4"
    //       ],
    //       "cachePolicy": "normal",
    //       "policyInfo": "00000000",
    //       "flags": "00000000",
    //       "acceptPlainTextPin": true,
    //       "generateSessionPin": false
    //     }
    //   },
    //   "importSupport": [
    //     "plainText",
    //     "rsaKeyest",
    //     "eccKeyest",
    //     "symmetric"
    //   ],
    //   "algorithms": [
    //     "AES"
    //   ],
    //   "paddingSchemes": [
    //     "block",
    //     "pkcs1",
    //     "pss",
    //     "oaep"
    //   ],
    //   "chainingModes": [
    //     "ChainingModeCBC"
    //   ]
    // }

    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    Get ComIntOf Of hoJson "bytesAvailable" To iBytesAvailable
    Get ComIntOf Of hoJson "containersAvailable" To iContainersAvailable
    Get ComIntOf Of hoJson "maxKeyContainers" To iMaxKeyContainers
    Get ComBoolOf Of hoJson "capabilities.fCertificateCompression" To iCapabilitiesFCertificateCompression
    Get ComBoolOf Of hoJson "capabilities.fKeyGen" To iCapabilitiesFKeyGen
    Get ComIntOf Of hoJson "keySizes.minimumBitlen" To iKeySizesMinimumBitlen
    Get ComIntOf Of hoJson "keySizes.defaultBitlen" To iKeySizesDefaultBitlen
    Get ComIntOf Of hoJson "keySizes.maximumBitlen" To iKeySizesMaximumBitlen
    Get ComIntOf Of hoJson "keySizes.incrementalBitlen" To iKeySizesIncrementalBitlen
    Get ComBoolOf Of hoJson "readOnly" To iReadOnly
    Get ComStringOf Of hoJson "cacheMode" To sCacheMode
    Get ComBoolOf Of hoJson "supportsWinX509Enrollment" To iSupportsWinX509Enrollment
    Get ComStringOf Of hoJson "guid" To sGuid
    Get ComStringOf Of hoJson "serial" To sSerial
    Get ComStringOf Of hoJson "pin.user.type" To sPinUserType
    Get ComStringOf Of hoJson "pin.user.purpose" To sPinUserPurpose
    Get ComStringOf Of hoJson "pin.user.cachePolicy" To sPinUserCachePolicy
    Get ComStringOf Of hoJson "pin.user.policyInfo" To sPinUserPolicyInfo
    Get ComStringOf Of hoJson "pin.user.flags" To sPinUserFlags
    Get ComBoolOf Of hoJson "pin.user.acceptPlainTextPin" To iPinUserAcceptPlainTextPin
    Get ComBoolOf Of hoJson "pin.user.generateSessionPin" To iPinUserGenerateSessionPin
    Get ComStringOf Of hoJson "pin.admin.type" To sPinAdminType
    Get ComStringOf Of hoJson "pin.admin.purpose" To sPinAdminPurpose
    Get ComStringOf Of hoJson "pin.admin.cachePolicy" To sPinAdminCachePolicy
    Get ComStringOf Of hoJson "pin.admin.policyInfo" To sPinAdminPolicyInfo
    Get ComStringOf Of hoJson "pin.admin.flags" To sPinAdminFlags
    Get ComStringOf Of hoJson "pin.role3.type" To sPinRole3Type
    Get ComStringOf Of hoJson "pin.role3.purpose" To sPinRole3Purpose
    Get ComStringOf Of hoJson "pin.role3.cachePolicy" To sPinRole3CachePolicy
    Get ComStringOf Of hoJson "pin.role3.policyInfo" To sPinRole3PolicyInfo
    Get ComStringOf Of hoJson "pin.role3.flags" To sPinRole3Flags
    Get ComBoolOf Of hoJson "pin.role3.acceptPlainTextPin" To iPinRole3AcceptPlainTextPin
    Get ComBoolOf Of hoJson "pin.role3.generateSessionPin" To iPinRole3GenerateSessionPin
    Get ComStringOf Of hoJson "pin.role4.type" To sPinRole4Type
    Get ComStringOf Of hoJson "pin.role4.purpose" To sPinRole4Purpose
    Get ComStringOf Of hoJson "pin.role4.cachePolicy" To sPinRole4CachePolicy
    Get ComStringOf Of hoJson "pin.role4.policyInfo" To sPinRole4PolicyInfo
    Get ComStringOf Of hoJson "pin.role4.flags" To sPinRole4Flags
    Get ComBoolOf Of hoJson "pin.role4.acceptPlainTextPin" To iPinRole4AcceptPlainTextPin
    Get ComBoolOf Of hoJson "pin.role4.generateSessionPin" To iPinRole4GenerateSessionPin
    Move 0 To i
    Get ComSizeOfArray Of hoJson "pins" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pins[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.user.changePermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.user.changePermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.user.unblockPermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.user.unblockPermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.admin.changePermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.admin.changePermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.role3.changePermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.role3.changePermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.role3.unblockPermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.role3.unblockPermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "pin.role4.changePermission" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "pin.role4.changePermission[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "importSupport" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "importSupport[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "algorithms" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "algorithms[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "paddingSchemes" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "paddingSchemes[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "chainingModes" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "chainingModes[i]" To sStrVal
        Move (i + 1) To i
    Loop

    // Delete the context when finished with the card.
    Get ComDeleteContext Of hoScmd To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoScmd To sTemp1
        Showln sTemp1
    End



End_Procedure

 

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