Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Node.js) Apple Keychain - Import ECDSA Private KeySee more Apple Keychain ExamplesImports an ECDSA private key to the Apple Keychain. Note: This example requires Chilkat v10.0.0 or greater.
var os = require('os'); if (os.platform() == 'win32') { var chilkat = require('@chilkat/ck-node23-win64'); } else if (os.platform() == 'linux') { if (os.arch() == 'arm') { var chilkat = require('@chilkat/ck-node23-linux-arm'); } else if (os.arch() == 'arm64') { var chilkat = require('@chilkat/ck-node23-linux-arm64'); } else { var chilkat = require('@chilkat/ck-node23-linux-x64'); } } else if (os.platform() == 'darwin') { var chilkat = require('@chilkat/ck-node23-mac-universal'); } function chilkatExample() { var pemPath = "/Users/chilkat/qa_data/ecc/prime256v1-privKey.pem"; // Provide a password if your PEM is encrypted. Otherwise pass the empty string. var pemPassword = ""; var privKey = new chilkat.PrivateKey(); var success = privKey.LoadAnyFormatFile(pemPath,pemPassword); if (success == false) { console.log(privKey.LastErrorText); return; } // 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>" success = privKey.SavePkcs8File("keychain:MyEcdsaKey123"); if (success == false) { console.log(privKey.LastErrorText); return; } console.log("Success."); // Here you can see: // // } chilkatExample(); |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.