Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Using a .NET .snk Key File for RSA EncryptionDemonstrates how to load and use a .NET .snk key file for RSA encryption. SNK files are created by the Microsoft .NET Strong Name Tool (Sn.exe).
LOCAL loRsa LOCAL lnSuccess LOCAL lcXmlKey LOCAL lnBUsePrivateKey LOCAL lcEncryptedText LOCAL lcDecryptedText loRsa = CreateObject('Chilkat.Rsa') lnSuccess = loRsa.UnlockComponent("Anything for 30-day trial") IF (lnSuccess <> 1) THEN =MESSAGEBOX("RSA component unlock failed") QUIT ENDIF * Load a public/private key pair from a .snk key file. lcXmlKey = loRsa.SnkToXml("chilkat2.snk") ? lcXmlKey * The xmlKey contains both public and private keys. * Import either the public or private for encrypting or * decrypting. loRsa.ImportPrivateKey(lcXmlKey) lnBUsePrivateKey = 1 lcEncryptedText = loRsa.EncryptStringENC("Hello World!",lnBUsePrivateKey) ? lcEncryptedText * Now decrypt with the public key: loRsa.ImportPublicKey(lcXmlKey) lnBUsePrivateKey = 0 lcDecryptedText = loRsa.DecryptStringENC(lcEncryptedText,lnBUsePrivateKey) ? lcDecryptedText * Note: We could have just as well encrypted using the public key * and decrypted using the private key. |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser