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
(Visual FoxPro) ScMinidriver - Get Smartcard PropertiesSee more ScMinidriver ExamplesGets information about the smart card currently inserted in the reader (or USB token).
LOCAL loScmd LOCAL lcReaderName LOCAL lnSuccess LOCAL loJson LOCAL lcStrVal LOCAL lnBytesAvailable LOCAL lnContainersAvailable LOCAL lnMaxKeyContainers LOCAL lnCapabilitiesFCertificateCompression LOCAL lnCapabilitiesFKeyGen LOCAL lnKeySizesMinimumBitlen LOCAL lnKeySizesDefaultBitlen LOCAL lnKeySizesMaximumBitlen LOCAL lnKeySizesIncrementalBitlen LOCAL lnReadOnly LOCAL lcCacheMode LOCAL lnSupportsWinX509Enrollment LOCAL lcGuid LOCAL lcSerial LOCAL lcPinUserType LOCAL lcPinUserPurpose LOCAL lcPinUserCachePolicy LOCAL lcPinUserPolicyInfo LOCAL lcPinUserFlags LOCAL lnPinUserAcceptPlainTextPin LOCAL lnPinUserGenerateSessionPin LOCAL lcPinAdminType LOCAL lcPinAdminPurpose LOCAL lcPinAdminCachePolicy LOCAL lcPinAdminPolicyInfo LOCAL lcPinAdminFlags LOCAL lcPinRole3Type LOCAL lcPinRole3Purpose LOCAL lcPinRole3CachePolicy LOCAL lcPinRole3PolicyInfo LOCAL lcPinRole3Flags LOCAL lnPinRole3AcceptPlainTextPin LOCAL lnPinRole3GenerateSessionPin LOCAL lcPinRole4Type LOCAL lcPinRole4Purpose LOCAL lcPinRole4CachePolicy LOCAL lcPinRole4PolicyInfo LOCAL lcPinRole4Flags LOCAL lnPinRole4AcceptPlainTextPin LOCAL lnPinRole4GenerateSessionPin LOCAL i LOCAL lnCount_i * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.ScMinidriver') loScmd = CreateObject('Chilkat.ScMinidriver') * Reader names (smart card readers or USB tokens) can be discovered * via PCSC List Readers or PCSC Find Smart Cards lcReaderName = "Alcor Micro USB Smart Card Reader 0" lnSuccess = loScmd.AcquireContext(lcReaderName) IF (lnSuccess = 0) THEN ? loScmd.LastErrorText RELEASE loScmd CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.EmitCompact = 0 lnSuccess = loScmd.GetCardProperties(loJson) IF (lnSuccess = 0) THEN ? loScmd.LastErrorText RELEASE loScmd RELEASE loJson CANCEL ENDIF ? loJson.Emit() * 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 lnBytesAvailable = loJson.IntOf("bytesAvailable") lnContainersAvailable = loJson.IntOf("containersAvailable") lnMaxKeyContainers = loJson.IntOf("maxKeyContainers") lnCapabilitiesFCertificateCompression = loJson.BoolOf("capabilities.fCertificateCompression") lnCapabilitiesFKeyGen = loJson.BoolOf("capabilities.fKeyGen") lnKeySizesMinimumBitlen = loJson.IntOf("keySizes.minimumBitlen") lnKeySizesDefaultBitlen = loJson.IntOf("keySizes.defaultBitlen") lnKeySizesMaximumBitlen = loJson.IntOf("keySizes.maximumBitlen") lnKeySizesIncrementalBitlen = loJson.IntOf("keySizes.incrementalBitlen") lnReadOnly = loJson.BoolOf("readOnly") lcCacheMode = loJson.StringOf("cacheMode") lnSupportsWinX509Enrollment = loJson.BoolOf("supportsWinX509Enrollment") lcGuid = loJson.StringOf("guid") lcSerial = loJson.StringOf("serial") lcPinUserType = loJson.StringOf("pin.user.type") lcPinUserPurpose = loJson.StringOf("pin.user.purpose") lcPinUserCachePolicy = loJson.StringOf("pin.user.cachePolicy") lcPinUserPolicyInfo = loJson.StringOf("pin.user.policyInfo") lcPinUserFlags = loJson.StringOf("pin.user.flags") lnPinUserAcceptPlainTextPin = loJson.BoolOf("pin.user.acceptPlainTextPin") lnPinUserGenerateSessionPin = loJson.BoolOf("pin.user.generateSessionPin") lcPinAdminType = loJson.StringOf("pin.admin.type") lcPinAdminPurpose = loJson.StringOf("pin.admin.purpose") lcPinAdminCachePolicy = loJson.StringOf("pin.admin.cachePolicy") lcPinAdminPolicyInfo = loJson.StringOf("pin.admin.policyInfo") lcPinAdminFlags = loJson.StringOf("pin.admin.flags") lcPinRole3Type = loJson.StringOf("pin.role3.type") lcPinRole3Purpose = loJson.StringOf("pin.role3.purpose") lcPinRole3CachePolicy = loJson.StringOf("pin.role3.cachePolicy") lcPinRole3PolicyInfo = loJson.StringOf("pin.role3.policyInfo") lcPinRole3Flags = loJson.StringOf("pin.role3.flags") lnPinRole3AcceptPlainTextPin = loJson.BoolOf("pin.role3.acceptPlainTextPin") lnPinRole3GenerateSessionPin = loJson.BoolOf("pin.role3.generateSessionPin") lcPinRole4Type = loJson.StringOf("pin.role4.type") lcPinRole4Purpose = loJson.StringOf("pin.role4.purpose") lcPinRole4CachePolicy = loJson.StringOf("pin.role4.cachePolicy") lcPinRole4PolicyInfo = loJson.StringOf("pin.role4.policyInfo") lcPinRole4Flags = loJson.StringOf("pin.role4.flags") lnPinRole4AcceptPlainTextPin = loJson.BoolOf("pin.role4.acceptPlainTextPin") lnPinRole4GenerateSessionPin = loJson.BoolOf("pin.role4.generateSessionPin") i = 0 lnCount_i = loJson.SizeOfArray("pins") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pins[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.user.changePermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.user.changePermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.user.unblockPermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.user.unblockPermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.admin.changePermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.admin.changePermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.role3.changePermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.role3.changePermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.role3.unblockPermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.role3.unblockPermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("pin.role4.changePermission") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("pin.role4.changePermission[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("importSupport") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("importSupport[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("algorithms") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("algorithms[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("paddingSchemes") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("paddingSchemes[i]") i = i + 1 ENDDO i = 0 lnCount_i = loJson.SizeOfArray("chainingModes") DO WHILE i < lnCount_i loJson.I = i lcStrVal = loJson.StringOf("chainingModes[i]") i = i + 1 ENDDO * Delete the context when finished with the card. lnSuccess = loScmd.DeleteContext() IF (lnSuccess = 0) THEN ? loScmd.LastErrorText ENDIF RELEASE loScmd RELEASE loJson |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.