Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1314
  • Last Modified:

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

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
ClassicCPLus
Asked:
ClassicCPLus
1 Solution
 
vr6rCommented:
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
 
ClassicCPLusAuthor Commented:
Thank You!!!! it worked perfect :). Have a wonderful x-mas the best for 2014.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now