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

Lianja 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
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

 

 

 

(Lianja) Binary Certificate Extension Data

See more Certificates Examples

Demonstrates how to binary certificate extension data by OID.

The GetExtensionBd method is added in Chilkat v9.5.0.96.

Chilkat Lianja Extension Download

Chilkat Lianja Extension

loCert = createobject("CkCert")

llSuccess = loCert.LoadFromFile("qa_data/certs/testCert.cer")
if (llSuccess = .F.) then
    ? loCert.LastErrorText
    release loCert
    return
endif

loBd = createobject("CkBinData")

// The particular certificate in this test contains the following extensions

lcOid = "1.2.250.1.71.1.2.5"
llSuccess = loCert.GetExtensionBd(lcOid,loBd)
if (llSuccess = .T.) then
    ? lcOid + ": " + loBd.GetEncoded("hex_lower")
endif

lcOid = "1.2.250.1.71.1.2.2"
llSuccess = loCert.GetExtensionBd(lcOid,loBd)
if (llSuccess = .T.) then
    ? lcOid + ": " + loBd.GetEncoded("hex_lower")
endif

lcOid = "1.2.250.1.71.1.2.3"
llSuccess = loCert.GetExtensionBd(lcOid,loBd)
if (llSuccess = .T.) then
    ? lcOid + ": " + loBd.GetEncoded("hex_lower")
endif

lcOid = "1.2.250.1.71.1.2.7"
llSuccess = loCert.GetExtensionBd(lcOid,loBd)
if (llSuccess = .T.) then
    ? lcOid + ": " + loBd.GetEncoded("hex_lower")
endif

lcOid = "1.2.250.1.71.4.2.5"
llSuccess = loCert.GetExtensionBd(lcOid,loBd)
if (llSuccess = .T.) then
    ? lcOid + ": " + loBd.GetEncoded("hex_lower")
endif

// Sample output:
// 1.2.250.1.71.1.2.5: 040180
// 1.2.250.1.71.1.2.2: 020100
// 1.2.250.1.71.1.2.3: 1315383032353030303030312f32393030303539313432
// 1.2.250.1.71.1.2.7: 02010a
// 1.2.250.1.71.4.2.5: 30060c04534d3236

// The above binary values are actually ASN.1
// You can get the ASN.1 decoed by calling GetExtensionAsXml to get it in XML format,
// and then you extract the values from the XML.

lcOid = "1.2.250.1.71.1.2.5"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
if (loCert.LastMethodSuccess = .T.) then
    ? lcOid + ": " + lcStrXml
endif

lcOid = "1.2.250.1.71.1.2.2"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
if (loCert.LastMethodSuccess = .T.) then
    ? lcOid + ": " + lcStrXml
endif

lcOid = "1.2.250.1.71.1.2.3"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
if (loCert.LastMethodSuccess = .T.) then
    ? lcOid + ": " + lcStrXml
endif

lcOid = "1.2.250.1.71.1.2.7"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
if (loCert.LastMethodSuccess = .T.) then
    ? lcOid + ": " + lcStrXml
endif

lcOid = "1.2.250.1.71.4.2.5"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
if (loCert.LastMethodSuccess = .T.) then
    ? lcOid + ": " + lcStrXml
endif

// Sample output:
// 1.2.250.1.71.1.2.5: <octets>gA==</octets>
// 1.2.250.1.71.1.2.2: <int>00</int>
// 1.2.250.1.71.1.2.3: <printable>8025000001/2900059142</printable>
// 1.2.250.1.71.1.2.7: <int>0A</int>
// 1.2.250.1.71.4.2.5: <sequence><utf8>SM26</utf8></sequence>

// "gA==" is the base64 encoded byte values
// "0A" is hex for decimal 1


release loCert
release loBd

 

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