Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: How Pin
Blue_Boy6-Sep-08 13:07
Blue_Boy6-Sep-08 13:07 
GeneralRe: How Pin
#realJSOP7-Sep-08 2:01
professional#realJSOP7-Sep-08 2:01 
QuestionHow to convert one byte to string? Pin
nhatvhm6-Sep-08 0:44
nhatvhm6-Sep-08 0:44 
AnswerRe: How to convert one byte to string? Pin
prasadbuddhika6-Sep-08 0:59
prasadbuddhika6-Sep-08 0:59 
AnswerRe: How to convert one byte to string? Pin
User 66586-Sep-08 1:08
User 66586-Sep-08 1:08 
AnswerRe: How to convert one byte to string? Pin
Guffa6-Sep-08 1:51
Guffa6-Sep-08 1:51 
GeneralRe: How to convert one byte to string? Pin
Daniel Grunwald6-Sep-08 2:03
Daniel Grunwald6-Sep-08 2:03 
Questionproblem with asymchronus decrypting Pin
prasadbuddhika6-Sep-08 0:22
prasadbuddhika6-Sep-08 0:22 
this is the code i use to encrypt the "ser.xml"and send it to the server.
but when trying to decrypt this at server i get the exception "Unable to cast object of type 'System.Security.Cryptography.RSACryptoServiceProvider' to type 'System.Security.Cryptography.SymmetricAlgorithm'."

private void encrypt_msgxml()
        {
            XmlDocument xmldoc = new XmlDocument();
            XmlElement element_to_enc;
            Rijndael sessionkey;
            EncryptedXml enxml = new EncryptedXml();
            byte[] encryp_bytes;
            byte[] encrypt_keyarray;
            EncryptedData encrypt_element;

            xmldoc.PreserveWhitespace = true;
            xmldoc.Load("ser.xml");

            element_to_enc = xmldoc.GetElementsByTagName("message")[0] as XmlElement;

            sessionkey = new RijndaelManaged();
            sessionkey.KeySize = 256;

            encryp_bytes = enxml.EncryptData(element_to_enc, sessionkey, false);

            encrypt_element = new EncryptedData();
            encrypt_element.Type = EncryptedXml.XmlEncElementUrl;

            encrypt_element.EncryptionMethod = new EncryptionMethod(EncryptedXml.XmlEncAES256Url);

            EncryptedKey encrypt_key = new EncryptedKey();
            encrypt_keyarray = EncryptedXml.EncryptKey(sessionkey.Key, rrsa, false);
            encrypt_key.CipherData = new CipherData(encrypt_keyarray);
            encrypt_key.EncryptionMethod = new EncryptionMethodEncryptedXml.XmlEncRSA15Url);

            encrypt_element.KeyInfo = new KeyInfo();
            KeyInfoName kin = new KeyInfoName();
            kin.Value = "cli_ser_pub_key";
            encrypt_element.KeyInfo.AddClause(kin);

            encrypt_element.KeyInfo.AddClause(new KeyInfoEncryptedKey(encrypt_key));

            encrypt_element.CipherData.CipherValue = encryp_bytes;
            EncryptedXml.ReplaceElement(element_to_enc, encrypt_element, false);
            xmldoc.Save("test.xml");
        }


this is the code to decrypt.(i have created the rsa object in the server )

public void decrypt_msgxml()
        {

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.PreserveWhitespace = true;
            xmlDoc.Load("test.xml");
            EncryptedXml exml = new EncryptedXml(xmlDoc);
            exml.AddKeyNameMapping("cli_ser_pub_key", rsa);
            exml.DecryptDocument();
        }

can you tell me the reason for this.
AnswerRe: problem with asymchronus decrypting Pin
leppie6-Sep-08 5:40
leppie6-Sep-08 5:40 
AnswerRe: problem with asymchronus decrypting Pin
Mbah Dhaim6-Sep-08 8:24
Mbah Dhaim6-Sep-08 8:24 
QuestionFade in control in C# Pin
Chazzysb6-Sep-08 0:07
Chazzysb6-Sep-08 0:07 
AnswerRe: Fade in control in C# Pin
#realJSOP6-Sep-08 2:01
professional#realJSOP6-Sep-08 2:01 
AnswerRe: Fade in control in C# Pin
Dave Kreskowiak6-Sep-08 3:49
mveDave Kreskowiak6-Sep-08 3:49 
GeneralRe: Fade in control in C# Pin
perryf_006-Sep-08 16:44
perryf_006-Sep-08 16:44 
GeneralRe: Fade in control in C# Pin
Dave Kreskowiak6-Sep-08 20:05
mveDave Kreskowiak6-Sep-08 20:05 
GeneralRe: Fade in control in C# Pin
perryf_007-Sep-08 5:54
perryf_007-Sep-08 5:54 
GeneralRe: Fade in control in C# Pin
Dave Kreskowiak7-Sep-08 9:57
mveDave Kreskowiak7-Sep-08 9:57 
GeneralRe: Fade in control in C# Pin
perryf_007-Sep-08 11:08
perryf_007-Sep-08 11:08 
AnswerRe: Fade in control in C# Pin
Chazzysb6-Sep-08 4:15
Chazzysb6-Sep-08 4:15 
QuestionHelp Pin
Angelinna5-Sep-08 22:45
Angelinna5-Sep-08 22:45 
AnswerRe: Help Pin
Manas Bhardwaj5-Sep-08 23:25
professionalManas Bhardwaj5-Sep-08 23:25 
AnswerRe: Help Pin
zafersavas5-Sep-08 23:39
zafersavas5-Sep-08 23:39 
GeneralRe: Help [modified] Pin
Angelinna6-Sep-08 0:21
Angelinna6-Sep-08 0:21 
GeneralRe: Help Pin
#realJSOP6-Sep-08 2:02
professional#realJSOP6-Sep-08 2:02 
GeneralRe: Help Pin
Paul Conrad6-Sep-08 5:06
professionalPaul Conrad6-Sep-08 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.