Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) ScMinidriver - Get Smartcard PropertiesSee more ScMinidriver ExamplesGets information about the smart card currently inserted in the reader (or USB token).
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oScmd = ObjCreate("Chilkat.ScMinidriver") ; Reader names (smart card readers or USB tokens) can be discovered ; via PCSC List Readers or PCSC Find Smart Cards Local $sReaderName = "Alcor Micro USB Smart Card Reader 0" Local $bSuccess = $oScmd.AcquireContext($sReaderName) If ($bSuccess = False) Then ConsoleWrite($oScmd.LastErrorText & @CRLF) Exit EndIf $oJson = ObjCreate("Chilkat.JsonObject") $oJson.EmitCompact = False $bSuccess = $oScmd.GetCardProperties($oJson) If ($bSuccess = False) Then ConsoleWrite($oScmd.LastErrorText & @CRLF) Exit EndIf ConsoleWrite($oJson.Emit() & @CRLF) ; 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 Local $strVal Local $iBytesAvailable = $oJson.IntOf("bytesAvailable") Local $iContainersAvailable = $oJson.IntOf("containersAvailable") Local $iMaxKeyContainers = $oJson.IntOf("maxKeyContainers") Local $bCapabilitiesFCertificateCompression = $oJson.BoolOf("capabilities.fCertificateCompression") Local $bCapabilitiesFKeyGen = $oJson.BoolOf("capabilities.fKeyGen") Local $iKeySizesMinimumBitlen = $oJson.IntOf("keySizes.minimumBitlen") Local $iKeySizesDefaultBitlen = $oJson.IntOf("keySizes.defaultBitlen") Local $iKeySizesMaximumBitlen = $oJson.IntOf("keySizes.maximumBitlen") Local $iKeySizesIncrementalBitlen = $oJson.IntOf("keySizes.incrementalBitlen") Local $bReadOnly = $oJson.BoolOf("readOnly") Local $sCacheMode = $oJson.StringOf("cacheMode") Local $bSupportsWinX509Enrollment = $oJson.BoolOf("supportsWinX509Enrollment") Local $sGuid = $oJson.StringOf("guid") Local $serial = $oJson.StringOf("serial") Local $sPinUserType = $oJson.StringOf("pin.user.type") Local $sPinUserPurpose = $oJson.StringOf("pin.user.purpose") Local $sPinUserCachePolicy = $oJson.StringOf("pin.user.cachePolicy") Local $sPinUserPolicyInfo = $oJson.StringOf("pin.user.policyInfo") Local $sPinUserFlags = $oJson.StringOf("pin.user.flags") Local $bPinUserAcceptPlainTextPin = $oJson.BoolOf("pin.user.acceptPlainTextPin") Local $bPinUserGenerateSessionPin = $oJson.BoolOf("pin.user.generateSessionPin") Local $sPinAdminType = $oJson.StringOf("pin.admin.type") Local $sPinAdminPurpose = $oJson.StringOf("pin.admin.purpose") Local $sPinAdminCachePolicy = $oJson.StringOf("pin.admin.cachePolicy") Local $sPinAdminPolicyInfo = $oJson.StringOf("pin.admin.policyInfo") Local $sPinAdminFlags = $oJson.StringOf("pin.admin.flags") Local $sPinRole3Type = $oJson.StringOf("pin.role3.type") Local $sPinRole3Purpose = $oJson.StringOf("pin.role3.purpose") Local $sPinRole3CachePolicy = $oJson.StringOf("pin.role3.cachePolicy") Local $sPinRole3PolicyInfo = $oJson.StringOf("pin.role3.policyInfo") Local $sPinRole3Flags = $oJson.StringOf("pin.role3.flags") Local $bPinRole3AcceptPlainTextPin = $oJson.BoolOf("pin.role3.acceptPlainTextPin") Local $bPinRole3GenerateSessionPin = $oJson.BoolOf("pin.role3.generateSessionPin") Local $sPinRole4Type = $oJson.StringOf("pin.role4.type") Local $sPinRole4Purpose = $oJson.StringOf("pin.role4.purpose") Local $sPinRole4CachePolicy = $oJson.StringOf("pin.role4.cachePolicy") Local $sPinRole4PolicyInfo = $oJson.StringOf("pin.role4.policyInfo") Local $sPinRole4Flags = $oJson.StringOf("pin.role4.flags") Local $bPinRole4AcceptPlainTextPin = $oJson.BoolOf("pin.role4.acceptPlainTextPin") Local $bPinRole4GenerateSessionPin = $oJson.BoolOf("pin.role4.generateSessionPin") Local $i = 0 Local $iCount_i = $oJson.SizeOfArray("pins") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pins[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.user.changePermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.user.changePermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.user.unblockPermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.user.unblockPermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.admin.changePermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.admin.changePermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.role3.changePermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.role3.changePermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.role3.unblockPermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.role3.unblockPermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("pin.role4.changePermission") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("pin.role4.changePermission[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("importSupport") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("importSupport[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("algorithms") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("algorithms[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("paddingSchemes") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("paddingSchemes[i]") $i = $i + 1 Wend $i = 0 $iCount_i = $oJson.SizeOfArray("chainingModes") While $i < $iCount_i $oJson.I = $i $strVal = $oJson.StringOf("chainingModes[i]") $i = $i + 1 Wend ; Delete the context when finished with the card. $bSuccess = $oScmd.DeleteContext() If ($bSuccess = False) Then ConsoleWrite($oScmd.LastErrorText & @CRLF) EndIf |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.