Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Tcl 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
Apple Keychain
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
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

 

 

 

(Tcl) Apple Keychain - Import RSA Private Key

See more Apple Keychain Examples

Imports an RSA private key to the Apple Keychain.

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

set pemPath "/Users/chilkat/qa_data/rsa/rsaPrivKey_pkcs8.pem"
# Provide a password if your PEM is encrypted. Otherwise pass the empty string.
set pemPassword ""

set privKey [new_CkPrivateKey]

set success [CkPrivateKey_LoadAnyFormatFile $privKey $pemPath $pemPassword]
if {$success == 0} then {
    puts [CkPrivateKey_lastErrorText $privKey]
    delete_CkPrivateKey $privKey
    exit
}

# In Apple Keychain, the label for an item such as a private key is a user-friendly identifier that helps distinguish one item from
# another in the Keychain. It is typically a brief name or description associated with the item. 
# The label is displayed in the Keychain Access application and is useful for quickly identifying the purpose
# or source of a specific key, certificate, or password entry.

# The label does not affect the functionality or security of the item; it is purely for organizational purposes. 
# You can edit or assign labels to make your Keychain easier to navigate.

# On MacOS, you can save the private key to the Keychain by calling SavePkcs8File with a "filename" in the format"keychain:<label>"
set success [CkPrivateKey_SavePkcs8File $privKey "keychain:MyRsaKey123"]
if {$success == 0} then {
    puts [CkPrivateKey_lastErrorText $privKey]
    delete_CkPrivateKey $privKey
    exit
}

puts "Success."

# Here you can see:
# 
# 

delete_CkPrivateKey $privKey

 

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