Question:
We are trying to generate an RSA key pair, then encrypt privatekey w/password, then store the encrypted value in a table.
See this example:
ASP: Generate RSA Key and Export to Encrypted PEM
SQL Server: Generate RSA Key and Export to Encrypted PEM
C#: Generate RSA Key and Export to Encrypted PEM
C++: Generate RSA Key and Export to Encrypted PEM
Unicode C++: Generate RSA Key and Export to Encrypted PEM
Objective-C: Generate RSA Key and Export to Encrypted PEM
IOS: Generate RSA Key and Export to Encrypted PEM
PowerShell: Generate RSA Key and Export to Encrypted PEM
MFC: Generate RSA Key and Export to Encrypted PEM
C: Generate RSA Key and Export to Encrypted PEM
Unicode C: Generate RSA Key and Export to Encrypted PEM
Delphi: Generate RSA Key and Export to Encrypted PEM
DelphiDll: Generate RSA Key and Export to Encrypted PEM
Visual FoxPro: Generate RSA Key and Export to Encrypted PEM
Java: Generate RSA Key and Export to Encrypted PEM
Androidâ„¢: Generate RSA Key and Export to Encrypted PEM
Perl: Generate RSA Key and Export to Encrypted PEM
PHP: Generate RSA Key and Export to Encrypted PEM
PHP: Generate RSA Key and Export to Encrypted PEM
Python: Generate RSA Key and Export to Encrypted PEM
Ruby: Generate RSA Key and Export to Encrypted PEM
VB.NET: Generate RSA Key and Export to Encrypted PEM
encrypt with public key to decrypt, select row, and load the private key use decrypt, setting the usePrivatekey to 1.
my $rsaEncryptor = new chilkat::CkRsa(); $success = $rsaEncryptor->UnlockComponent("ComponentKey"); if ($success != 1) { print "RSA component unlock failed" . "n"; exit; }
$rsaEncryptor->put_EncodingMode("hex");
$rsaEncryptor->ImportPublicKey($public);
$usePrivateKey = 0; my $encryptedStr; connectDB();
if (open(MYFILE, "c:\public\passwd")) { $line = <myfile>; while ($line ne "") { chomp($line); $id = trim(substr($line,0,48)); $pass = trim(substr($line,48,32)); $encryptedStr = $rsaEncryptor->encryptStringENC($pass,$usePrivateKey); insertDB($id, $encryptedStr); $line = <myfile>; } } else { die("Cannot open the file INPUT"); } close MYFILE; disConnectDB();