![]() |
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
(Lianja) Generate an RSA Key and Save to Encrypted PEMSee more RSA ExamplesDemonstrates how to generate an RSA key and save to an encrypted PEM file.
loRsa = createobject("CkRsa") // Generate a 2048-bit key. llSuccess = loRsa.GenerateKey(2048) if (llSuccess = .F.) then ? loRsa.LastErrorText release loRsa return endif loPrivKey = loRsa.ExportPrivateKeyObj() lcPassword = "secret" // Saving to a relative path (from the current working directory of the process). lcPath = "rsaKeys/myTestRsaPrivate.pem" // Encrypt the PEM using 256-bit AES encryption. loPrivKey.Pkcs8EncryptAlg = "aes256" llSuccess = loPrivKey.SavePkcs8EncryptedPemFile(lcPassword,lcPath) if (llSuccess = .F.) then ? loPrivKey.LastErrorText release loRsa return endif release loPrivKey // |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.