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

PowerBuilder 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
Secrets
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

 

 

 

(PowerBuilder) 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

integer li_rc
oleobject loo_Scmd
string ls_ReaderName
integer li_Success
oleobject loo_Json
string ls_StrVal
integer li_BytesAvailable
integer li_ContainersAvailable
integer li_MaxKeyContainers
integer li_CapabilitiesFCertificateCompression
integer li_CapabilitiesFKeyGen
integer li_KeySizesMinimumBitlen
integer li_KeySizesDefaultBitlen
integer li_KeySizesMaximumBitlen
integer li_KeySizesIncrementalBitlen
integer li_ReadOnly
string ls_CacheMode
integer li_SupportsWinX509Enrollment
string ls_Guid
string ls_Serial
string ls_PinUserType
string ls_PinUserPurpose
string ls_PinUserCachePolicy
string ls_PinUserPolicyInfo
string ls_PinUserFlags
integer li_PinUserAcceptPlainTextPin
integer li_PinUserGenerateSessionPin
string ls_PinAdminType
string ls_PinAdminPurpose
string ls_PinAdminCachePolicy
string ls_PinAdminPolicyInfo
string ls_PinAdminFlags
string ls_PinRole3Type
string ls_PinRole3Purpose
string ls_PinRole3CachePolicy
string ls_PinRole3PolicyInfo
string ls_PinRole3Flags
integer li_PinRole3AcceptPlainTextPin
integer li_PinRole3GenerateSessionPin
string ls_PinRole4Type
string ls_PinRole4Purpose
string ls_PinRole4CachePolicy
string ls_PinRole4PolicyInfo
string ls_PinRole4Flags
integer li_PinRole4AcceptPlainTextPin
integer li_PinRole4GenerateSessionPin
integer i
integer li_Count_i

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

loo_Scmd = create oleobject
// Use "Chilkat_9_5_0.ScMinidriver" for versions of Chilkat < 10.0.0
li_rc = loo_Scmd.ConnectToNewObject("Chilkat.ScMinidriver")
if li_rc < 0 then
    destroy loo_Scmd
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Reader names (smart card readers or USB tokens) can be discovered
// via PCSC List Readers or PCSC Find Smart Cards
ls_ReaderName = "Alcor Micro USB Smart Card Reader 0"
li_Success = loo_Scmd.AcquireContext(ls_ReaderName)
if li_Success = 0 then
    Write-Debug loo_Scmd.LastErrorText
    destroy loo_Scmd
    return
end if

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.EmitCompact = 0

li_Success = loo_Scmd.GetCardProperties(loo_Json)
if li_Success = 0 then
    Write-Debug loo_Scmd.LastErrorText
    destroy loo_Scmd
    destroy loo_Json
    return
end if

Write-Debug loo_Json.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

li_BytesAvailable = loo_Json.IntOf("bytesAvailable")
li_ContainersAvailable = loo_Json.IntOf("containersAvailable")
li_MaxKeyContainers = loo_Json.IntOf("maxKeyContainers")
li_CapabilitiesFCertificateCompression = loo_Json.BoolOf("capabilities.fCertificateCompression")
li_CapabilitiesFKeyGen = loo_Json.BoolOf("capabilities.fKeyGen")
li_KeySizesMinimumBitlen = loo_Json.IntOf("keySizes.minimumBitlen")
li_KeySizesDefaultBitlen = loo_Json.IntOf("keySizes.defaultBitlen")
li_KeySizesMaximumBitlen = loo_Json.IntOf("keySizes.maximumBitlen")
li_KeySizesIncrementalBitlen = loo_Json.IntOf("keySizes.incrementalBitlen")
li_ReadOnly = loo_Json.BoolOf("readOnly")
ls_CacheMode = loo_Json.StringOf("cacheMode")
li_SupportsWinX509Enrollment = loo_Json.BoolOf("supportsWinX509Enrollment")
ls_Guid = loo_Json.StringOf("guid")
ls_Serial = loo_Json.StringOf("serial")
ls_PinUserType = loo_Json.StringOf("pin.user.type")
ls_PinUserPurpose = loo_Json.StringOf("pin.user.purpose")
ls_PinUserCachePolicy = loo_Json.StringOf("pin.user.cachePolicy")
ls_PinUserPolicyInfo = loo_Json.StringOf("pin.user.policyInfo")
ls_PinUserFlags = loo_Json.StringOf("pin.user.flags")
li_PinUserAcceptPlainTextPin = loo_Json.BoolOf("pin.user.acceptPlainTextPin")
li_PinUserGenerateSessionPin = loo_Json.BoolOf("pin.user.generateSessionPin")
ls_PinAdminType = loo_Json.StringOf("pin.admin.type")
ls_PinAdminPurpose = loo_Json.StringOf("pin.admin.purpose")
ls_PinAdminCachePolicy = loo_Json.StringOf("pin.admin.cachePolicy")
ls_PinAdminPolicyInfo = loo_Json.StringOf("pin.admin.policyInfo")
ls_PinAdminFlags = loo_Json.StringOf("pin.admin.flags")
ls_PinRole3Type = loo_Json.StringOf("pin.role3.type")
ls_PinRole3Purpose = loo_Json.StringOf("pin.role3.purpose")
ls_PinRole3CachePolicy = loo_Json.StringOf("pin.role3.cachePolicy")
ls_PinRole3PolicyInfo = loo_Json.StringOf("pin.role3.policyInfo")
ls_PinRole3Flags = loo_Json.StringOf("pin.role3.flags")
li_PinRole3AcceptPlainTextPin = loo_Json.BoolOf("pin.role3.acceptPlainTextPin")
li_PinRole3GenerateSessionPin = loo_Json.BoolOf("pin.role3.generateSessionPin")
ls_PinRole4Type = loo_Json.StringOf("pin.role4.type")
ls_PinRole4Purpose = loo_Json.StringOf("pin.role4.purpose")
ls_PinRole4CachePolicy = loo_Json.StringOf("pin.role4.cachePolicy")
ls_PinRole4PolicyInfo = loo_Json.StringOf("pin.role4.policyInfo")
ls_PinRole4Flags = loo_Json.StringOf("pin.role4.flags")
li_PinRole4AcceptPlainTextPin = loo_Json.BoolOf("pin.role4.acceptPlainTextPin")
li_PinRole4GenerateSessionPin = loo_Json.BoolOf("pin.role4.generateSessionPin")
i = 0
li_Count_i = loo_Json.SizeOfArray("pins")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pins[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.user.changePermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.user.changePermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.user.unblockPermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.user.unblockPermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.admin.changePermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.admin.changePermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.role3.changePermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.role3.changePermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.role3.unblockPermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.role3.unblockPermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("pin.role4.changePermission")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("pin.role4.changePermission[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("importSupport")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("importSupport[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("algorithms")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("algorithms[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("paddingSchemes")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("paddingSchemes[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("chainingModes")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("chainingModes[i]")
    i = i + 1
loop

// Delete the context when finished with the card.
li_Success = loo_Scmd.DeleteContext()
if li_Success = 0 then
    Write-Debug loo_Scmd.LastErrorText
end if



destroy loo_Scmd
destroy loo_Json

 

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