Error when trying to use MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper


Author
Message
Marcia G Akins
Marcia G Akins
StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi all.

I am trying to use this class to encrypt and decrypt parameters being passed to a web page in the Query String.

I used this code to Encrypt the value of the pk:

I am using this code in my ListView's RowPopulating event to create an "Edit" hyperlink in the first column:

string EncrytedSignOffID = _3des.Encrypt(e.BusinessObject["sign_off_id"].ToString());

e.Values[0].DisplayValue =
"<a href='EditSignOff.aspx?pk=" + EncrytedSignOffID + "&project_id=" + Request["pk"] + "'>Edit</a>";

When I click on the hyperlink to go to the Edit Page, I am trying to use this code in the Edit Page's Page_Load to decrypt the PK:

MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper _3des = new MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper();

String DecryptedSignOffID = _3des.Decrypt(Request["pk"].ToString());

But I wind up with this error instead of the web page:

System.FormatException was unhandled by user code
  Message=Invalid length for a Base-64 char array.
  Source=mscorlib
  StackTrace:
       at System.Convert.FromBase64String(String s)
       at MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper.Decrypt(String text)
       at StlCI_new.EditSignOff.Page_Load(Object sender, EventArgs e) in C:\StlCI_new\StlCI_new\StlCI_new\EditSignOff.aspx.cs:line 25
       at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
       at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:


Can someone help me out here? What do I need to do to make this work?

TIA.

Marcia.
Marcia G Akins
Marcia G Akins
StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)StrataFrame User (432 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Here I am talking to myself again Smile

I am posting this just in case someone else runs into the same problem:

I finally got this figured out. All I needed was this on the Decrypt:

String DecryptedSignOffID = _3des.Decrypt(Request["pk"].Replace(" ", "+"));
Edited 12 Years Ago by Marcia G Akins
Jeffrey K Cox
Jeffrey K Cox
StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)
Group: StrataFrame Users
Posts: 1, Visits: 3
Thanks for posting the solution dude. I was also experienced the same kind of problem. But now I also got this figured out.

human hair extensions
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search