Solved

RijndaelManaged Key and vector error "Specified key is not a valid size for this algorithm".

Posted on 2013-12-23
2
1,269 Views
Last Modified: 2013-12-24
Greetings Experts!

Will you send me an example of how to create the RijndaelManaged key and the vector and then how to convert it to a format I can save on the web.config, you see, I created it using RijndaelManaged.GenerateKey() and RijndaelManaged.GenerateIV() then converted to a string and saved it on the web.config . However when I retrieve the value from the web.config and then use Encoding.ASCII.GetBytes("Key") to pass the value to RijndaelManged.Key I get error: "Specified key is not a valid size for this algorithm". I hope this is clear, I really appreciate your help with this, I am stuck. I am using VS 2010, ASP.NET 4.0 with VB.NET 4.0,
0
Comment
Question by:ClassicCPLus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
vr6r earned 500 total points
ID: 39736702
Try using Convert.ToBase64String(key) to convert to a string to store in your webconfig, and then use Convert.FromBase64String("your_web_config_var") to convert back into a byte[] array to pass to your manage class.

I currently use this very method, except I store them as strings in sql.
0
 

Author Comment

by:ClassicCPLus
ID: 39738407
Thank You!!!! it worked perfect :). Have a wonderful x-mas the best for 2014.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you thought ransomware was bad, think again! Doxware has the potential to be even more damaging.
Provide an easy one stop to quickly get the relevant information on common asked question on Ransomware in Expert Exchange.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question