Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i have been looking for a way to use RSA encryption to encrypt text but also have a encryption key that can be displayed and later used to decrypt the text. I haven't found an example which meets my needs please help if you can!

What is needed:

1. Generate a RSA encryption key on button click(Encryption key must be able to be displayed in a textbox, Also this key must be able to be used by others to decrypt the text!)

2. Grab the RSA encrption key from a textbox on decryption (so in other words the user can input a key that has been sent by someone and they can use this key to decrypt the text)

3. Display the output of and encryption/decryption to a textbox.

Any help would be appreciated!

Thank you
Posted
Updated 16-May-16 14:02pm
v4

Not only this is impossible, it makes no sense at all. There are two keys, and the idea is radically different. You cannot write requirements having no clue on what you can and want to achieve. Start here: http://en.wikipedia.org/wiki/Public-key_cryptography[^].

Be careful: if you read it with attention, it should turn your brain inside out. :-)

—SA
 
Share this answer
 
Comments
Yusuf_20_x 20-Jun-15 9:32am    
i know there are two keys (private and public) but i was wondering if it would be possible to have a encryption key that can be used both by the encrypt-er and the recipient to decrypt the text rather than just encrypting text for the users eyes only
CPallini 20-Jun-15 9:59am    
There is symmetric key encription:
https://en.wikipedia.org/wiki/Symmetric-key_algorithm
The .NET framework provides classes for both symmetric and asymmetric algorithms:
https://msdn.microsoft.com/en-us/library/as0w18af(v=vs.110).aspx
Yusuf_20_x 20-Jun-15 10:03am    
Thank you CPallini but i already have a AES-256-Bit and a AES-128-Bit and A TDES text encrypter i was hoping to add RSA as a new type of encryption to the tool but hey people have to gd all sarcastic on me and send me to wiki pages -_-
Sergey Alexandrovich Kryukov 20-Jun-15 21:32pm    
This is because you are looking for the recipe, instead of getting to essence of things, which is what you really need. And if you are finding sending you to Wiki pages offensive or otherwise unpleasant, you've just chosen wrong profession. If you really need help and some results, you have to change your attitude. Sorry for touching this issues; I didn't want to, but you asked for it.

Anyway, don't get anything negatively. We are really trying to help you. Start with learning what cryptography really does, set aside "how to to it?" for a while, before you understand the ideas.

—SA
Yusuf_20_x 21-Jun-15 7:23am    
listen to it "wrong profession"? im doing this a pastime! i purpose you feel above new starters here and because you have high rep on this site that entitles you to make sarcastic comments and feel entitled to do so this real shows you have the lowest form of wit my friend! plus wiki isn't the best source of reliable information why couldn't you be more "profession" in your answer in the first place?

I am please you have address your sarcastic manner but i have seen so many people on this site who take up their high horses and flood questions in this way.
RSA is a very specific type of encryption. It is not normally used to encrypt blocks of data, it is in fact very poor at encrypting data - you can only encrypt a very small block using RSA, and it is computationally very expensive. You would never bother to use it like you would a symmetrical encryption algorithm. RSA (and it's older friend DSA) is normally used for secure message authentication (creating digital signatures) or to securely exchange symmetric keys for transferring larger amounts of data.

Asking the question as you did, was roughly equivalent to asking "instead of my truck, I'd like to use a Mini to transport shipping containers" or "how do I get my laser-jet to print in 3d" - the question itself is fundamentally flawed - so I hope you can understand why people are struggling to answer without resorting to sarcasm.

However I would like to point out that Sergey did point you to a very good resource, and added a big smiley to the end of his message so I wouldn't take that as sarcasm.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900