All wodCrypt (12) wodSSH (10) wodSFTP (23) wodSSHServer (1) wodSSHTunnel (11) wodSSHpackage wodSFTPdll wodSSH.NET (10) wodSFTP.NET (24) wodFtpDLX.NET (22) wodWebServer.NET (10) wodAppUpdate (13) wodHttpDLX (8) wodFtpDLX (22) wodTelnetDLX wodFTPServer (3) wodWebServer (10) wodVPN wodXMPP (13) | All ** [Visual Basic] ** [C#] ** [VB.NET] ** Encrypt data using private key
VB code
Dim wodCrypt1 As wodCryptCom Dim DecryptedText As MemBlob Dim EncryptedText As MemBlob Dim key As Keys Set wodCrypt1 = New wodCryptCom Set DecryptedText = New MemBlob Set EncryptedText = New MemBlob Set key = New Keys DecryptedText.Text = "this is data that we want to encrypt" 'First we need to load RSA or DSA public key from file using wodKeys component. 'wodKeys component is included in wodCrypt ActiveX component. key.PublicKeyLoad "c:\rsa_public.txt" 'Now we will encrypt data. wodCrypt1.Type = RSA wodCrypt1.Padding = PadPKCS7 'We need public key for encryption. wodCrypt1.SecretKey = key wodCrypt1.Encrypt DecryptedText, EncryptedText Debug.Print EncryptedText.ToBase64 VB.NET code
Dim wodCrypt1 As WODCRYPTCOMLib.wodCryptCom Dim DecryptedText As WODCRYPTCOMLib.MemBlob Dim EncryptedText As WODCRYPTCOMLib.MemBlob Dim key As wodKeys.Keys wodCrypt1 = New WODCRYPTCOMLib.wodCryptCom DecryptedText = New WODCRYPTCOMLib.MemBlob EncryptedText = New WODCRYPTCOMLib.MemBlob key = New wodKeys.Keys DecryptedText.Text = "this is data that we want to encrypt" 'First we need to load RSA or DSA public key from file using wodKeys component. 'wodKeys component is included in wodCrypt ActiveX component. key.PublicKeyLoad("c:\rsa_public.txt") 'Now we will encrypt data. wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.RSA wodCrypt1.Padding = WODCRYPTCOMLib.CryptoPadding.PadPKCS7 'We need public key for encryption. wodCrypt1.SecretKey = key wodCrypt1.Encrypt(DecryptedText, EncryptedText) Console.WriteLine(EncryptedText.ToBase64) C# code
WODCRYPTCOMLib.wodCryptCom wodCrypt1; WODCRYPTCOMLib.MemBlob DecryptedText; WODCRYPTCOMLib.MemBlob EncryptedText; wodKeys.Keys key; wodCrypt1 = new WODCRYPTCOMLib.wodCryptCom(); DecryptedText = new WODCRYPTCOMLib.MemBlob(); EncryptedText = new WODCRYPTCOMLib.MemBlob(); key = new wodKeys.Keys(); DecryptedText.Text = "this is data that we want to encrypt"; //First we need to load RSA or DSA public key from file using wodKeys component. //wodKeys component is included in wodCrypt ActiveX component. key.PublicKeyLoad("c:\\rsa_public.txt"); //Now we will encrypt data. wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.RSA; wodCrypt1.Padding = WODCRYPTCOMLib.CryptoPadding.PadPKCS7; //We need public key for encryption. wodCrypt1.SecretKey = key; wodCrypt1.Encrypt((WODCRYPTCOMLib.Blob)DecryptedText, (WODCRYPTCOMLib.Blob)EncryptedText); Console.WriteLine(EncryptedText.ToBase64()); |