Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
|
Generate RSA Public/Private Key Pair for Encryption (Key Exchange)ASP example code showing how to generate an RSA public/private key pair for encrypting. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% set rsa = Server.CreateObject("Chilkat.Rsa") success = rsa.UnlockComponent("Anything for 30-day trial") If (success <> 1) Then Response.Write "RSA component unlock failed" & "<br>" End If ' Generate a 1024-bit key. Chilkat RSA supports ' key sizes ranging from 512 bits to 4096 bits. success = rsa.GenerateKey(1024) If (success <> 1) Then Response.Write rsa.LastErrorText & "<br>" End If ' Keys are exported in XML format: publicKey = rsa.ExportPublicKey() Response.Write Server.HTMLEncode( publicKey) & "<br>" privateKey = rsa.ExportPrivateKey() Response.Write Server.HTMLEncode( privateKey) & "<br>" ' Note: For creating/validating signatures, use ' GenerateSignatureKey, ExportPublicSigKey, and ' ExportPrivateSigKey %> </body> </html> |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.