sattu Posted July 6, 2012 Posted July 6, 2012 Firstly I am completely new to this encryption and public key stuff. I have a Public key (in string format) which I need to use for Assymetric Encryption of my Data using the classes "RSACryptoServiceProvider" and "CspParameters" provided in Vb .Net. I did get lot of examples where they have mentioned regarding what I want, but I got thoroughly confused. My requirement is pretty simple. It is :- 1) I have two string variables say "PublicKey" and "Data". "PublicKey" variable contains the Key I need for encryption. Dim PublicKey as String = "KeyValue" Dim Data as String = "Value To Be Encrypted" 2) Declare an object of "RSACryptoServiceProvider" class and set the "PublicKey" in it. (Maybe using "CspParameters" class) Dim ObjRsa as new RSACryptoServiceProvider() ObjRsa.setPublicKey(PublicKey) //I know this line doesn't exist, but i want it's equivalent 3) Finally perform the encryption like this: Dim EncryptedData as new byte() = ObjRsa.Encrypt(Data) I was specially confused regarding the setting of "Public key" in either "RSACryptoServiceProvider" or "CspParameters" class objects, in all the examples that I found till date. I would be extremely glad if someone would guide me regarding this. Thanks In Advance Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.