Hi Paul,
I think I may be doing something wrong, so here are your instructions ....
Encoding of parameter is set to none by default, however this can be changed to Base64 encoding or to
Create a Single Parameter
defined. All the key-value pairs will be combined into a single string and Base64 Encoded.
when enabled will create a single parameter for all the key-values pairs
There are to many ways to encrypt and decrypt. To decrypt, it seems like you must use many of the same variables (key, IV, how the input is turned into bytes, etc), as was used during encryption.
The only way to guarantee I am decrypting correctly is if it works, it helps though if I know how the data was encrypted in the first place.
As for the use of the UrlUtils.DecryptParameter , the problem is that when a DNN IFrame launches its aspx or html, it does so
in a new thread. There are TONS of information, issues and problems on the web about this. When a new Thread is created in this IFrame scenerio, the HTTPContext.Items looses the ["PortalSettings"] item. The UrlUtils.DecryptParameter method needs at least the GUID from this or it bombs. So I dont understand how you used it in an IFrame scenerio ?
I am thinking that you may of used the UrlUtils.EncryptParameter ? When you did, of course it worked because you where in the Main Thread before
IFrame64 launched the aspx or html page from the IFrame with the newly encrypted parameter. But as I said, once the page is launched, it is in a whole new
thread so the Decrypt parameter does not appear to work.
Since you are not saying what you are using or how you are encrypting your data. This leaves this rookie at a disadvantage.
I have tested IFrame64 by running it with "Encoding of Parameter Values: None". I encrypted the value and decrypted it correctly using System.Security.Cryptography, TripleDESCryptoServiceProvider. The key I used was the MachineKey DecriptionKey from my web.config.
So, I have to ask myself, why can I encrypt and decrypt an IFrame64 "Encoding of Parameter Value: None". I used my sitekey (which
I think is suppose to be my MachineKey DecryptionKey), but I cannot decrypt the IFrame64 "Encoding of Parameter Value: Encrypt".
This is what I used for testing all of the scenerios I mentioned above ....
{
public static string Decrypt3DES(string EncryptedText, string DecryptionKey)// byte[] EText = System.Text.Encoding.UTF8.GetBytes(EncryptedText);
InitializationVector),
CStream.Write(EText, 0, EText.Length);
CStream.FlushFinalBlock();
System.Text.
}
Anyway, I have to think that if I can encrypt and decrypt a non encrypted value from IFrame64 using base64, then it must be something else that can only be determined by
knowing exactly how the data gets encrypted. Since the Encryption is based on my sitekey,
the logic should not pose any proprietary problems, if so, then your encryption cant be as simple as one of the standard API's, I am confused about why I should not be able to get that from you ?
I wish i could use your IFrame64, it was a great way to solve my problem. But, again,
its probably me not knowing what I am doing.
thanks
byte[] EText = Convert.FromBase64String(EncryptedText);byte[] DKey = System.Text.Encoding.UTF8.GetBytes(DecryptionKey);MemoryStream MStream = new MemoryStream();TripleDESCryptoServiceProvider CSProvider = new TripleDESCryptoServiceProvider();CryptoStream CStream = new CryptoStream(MStream, CSProvider.CreateDecryptor(DKey, CryptoStreamMode.Write);Encoding NCoding = System.Text.Encoding.UTF8;return NCoding.GetString(MStream.ToArray());I will buy the book suggested.
Encryption. The Encryption is based on the site keys associated with each individual Dotnetnuke site.