Python Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Python Examples

Quick Start
Python Unicode
Python Byte Array
Python Certs
Python Email
Python Encryption
Python FTP
HTML-to-XML
Python HTTP
Python IMAP
Python MHT
Python MIME
Python RSA
Python S/MIME
Python Signatures
Python Socket
Python Spider
Python Tar
Python Upload
Python XML
Python XMP
Python Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Generate RSA Public/Private Key Pair for Encryption (Key Exchange)

Python example code showing how to generate an RSA public/private key pair for encrypting.

Download Chilkat Python Library

import sys
import chilkat

rsa = chilkat.CkRsa()

success = rsa.UnlockComponent("Anything for 30-day trial")
if (success != True):
    print "RSA component unlock failed"
    sys.exit()

#  Generate a 1024-bit key.  Chilkat RSA supports
#  key sizes ranging from 512 bits to 4096 bits.
success = rsa.GenerateKey(1024)
if (success != True):
    print rsa.lastErrorText()
    sys.exit()

#  Keys are exported in XML format:
publicKey = rsa.exportPublicKey()
print publicKey

privateKey = rsa.exportPrivateKey()
print privateKey


 

Need a specific example? Send a request to support@chilkatsoft.com

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