Solved

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

Posted on 2013-12-23
2
1,224 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
2 Comments
 
LVL 8

Accepted Solution

by:
vr6r earned 500 total points
Comment Utility
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
Comment Utility
Thank You!!!! it worked perfect :). Have a wonderful x-mas the best for 2014.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Transferring data across the virtual world became simpler but protecting it is becoming a real security challenge.  How to approach cyber security  in today's business world!
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now