Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...