C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Load PEM Public/Private Key into RSA Object

Demonstrates how to load a PEM key into the Chilkat RSA object.

Download: Chilkat .NET Assemblies

Chilkat.Rsa rsa = new Chilkat.Rsa();

bool success;
success = rsa.UnlockComponent("Anything for 30-day trial");
if (success != true) {
    textBox1.Text += rsa.LastErrorText + "\r\n";
    return;
}

//  First demonstrate importing a PEM public key:
string publicKeyPem;
publicKeyPem = "PEM public-key data goes here";
Chilkat.PublicKey pubkey = new Chilkat.PublicKey();

success = pubkey.LoadOpenSslPem(publicKeyPem);
if (success != true) {
    textBox1.Text += pubkey.LastErrorText + "\r\n";
    return;
}

string publicKeyXml;
publicKeyXml = pubkey.GetXml();

success = rsa.ImportPublicKey(publicKeyXml);
if (success != true) {
    textBox1.Text += rsa.LastErrorText + "\r\n";
    return;
}

//  Demonstrate importing a PEM private key:
string privateKeyPem;
privateKeyPem = "PEM private-key data goes here";
Chilkat.PrivateKey privkey = new Chilkat.PrivateKey();

//  If the private key PEM is protected with a password, then
//  call LoadEncryptedPem.  Otherwise call LoadPem.
success = privkey.LoadPem(privateKeyPem);
if (success != true) {
    textBox1.Text += privkey.LastErrorText + "\r\n";
    return;
}

string privateKeyXml;
privateKeyXml = privkey.GetXml();
success = rsa.ImportPrivateKey(privateKeyXml);
if (success != true) {
    textBox1.Text += rsa.LastErrorText + "\r\n";
    return;
}

MessageBox.Show("OK!");

 

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

Email Component · XML Parser