Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
GeneralUser permissions to a DCOM object Pin
random420-Apr-08 19:15
random420-Apr-08 19:15 
GeneralRe: User permissions to a DCOM object Pin
Nouman Bhatti20-Apr-08 19:58
Nouman Bhatti20-Apr-08 19:58 
GeneralRe: User permissions to a DCOM object Pin
random421-Apr-08 18:33
random421-Apr-08 18:33 
GeneralLogin Winform Pin
ferspr20-Apr-08 17:34
ferspr20-Apr-08 17:34 
GeneralRe: Login Winform Pin
I.explore.code20-Apr-08 18:44
I.explore.code20-Apr-08 18:44 
GeneralRe: Login Winform Pin
ferspr20-Apr-08 19:27
ferspr20-Apr-08 19:27 
GeneralRe: Login Winform Pin
Nouman Bhatti20-Apr-08 20:04
Nouman Bhatti20-Apr-08 20:04 
GeneralProblem sending a public key encrypted string over a socket Pin
anth12320-Apr-08 13:04
anth12320-Apr-08 13:04 
Hi all.

The attached code works absolutely fine. However if I want to send the "encryptedString" over a socket I receive the following exception where the send fails:

"Exception: Found a high surrogate char without a following low surrogate at index: 8. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
Parameter name: chars"

However, this does work over the socket in about 1 in 10 times. I have also tried to send as bytes instead of string which solved the socket problem but corrupting the data so it couldn't be decrypted using the private key after transfer.

I am using .net 1.1

Does anyone know the solution to this problem?

Thanks, Anthony



// Represents UserA generating an rsa key pair

UnicodeEncoding byteConverter1 = new UnicodeEncoding();
RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider();
string publicKey = rsa1.ToXmlString(false);

// Represents UserB encrypting a message ("hello world") with UserA's public key

RSACryptoServiceProvider rsa2 = new RSACryptoServiceProvider();
rsa2.FromXmlString(publicKey);
UnicodeEncoding byteConverter2 = new UnicodeEncoding();
byte[] bytesToEncrypt = byteConverter2.GetBytes("hello world!");
byte[] encryptedBytes = rsa2.Encrypt(bytesToEncrypt,false);
string encryptedString = byteConverter2.GetString(encryptedBytes);

// Represents UserA decrypting the message with his private key

byte[] bytesToDecrypt = byteConverter1.GetBytes(encryptedString);
byte[] decryptedBytes = rsa1.Decrypt(bytesToDecrypt, false);
string message = byteConverter1.GetString(decryptedBytes);
string msg = message;
GeneralChanging propertie on other form. Pin
RitchieRich20-Apr-08 12:05
RitchieRich20-Apr-08 12:05 
GeneralRe: Changing propertie on other form. Pin
Christian Graus20-Apr-08 12:11
protectorChristian Graus20-Apr-08 12:11 
GeneralRe: Changing propertie on other form. Pin
cocoonwls20-Apr-08 20:21
cocoonwls20-Apr-08 20:21 
GeneralRe: Changing propertie on other form. [modified] Pin
RitchieRich20-Apr-08 23:48
RitchieRich20-Apr-08 23:48 
GeneralRe: Changing propertie on other form. Pin
cocoonwls22-Apr-08 18:32
cocoonwls22-Apr-08 18:32 
GeneralRender Vista Style ComboBox Pin
Lea Hayes20-Apr-08 10:03
Lea Hayes20-Apr-08 10:03 
GeneralRe: Render Vista Style ComboBox Pin
badtoto24-Dec-08 18:40
badtoto24-Dec-08 18:40 
GeneralRe: Render Vista Style ComboBox Pin
Lea Hayes26-Dec-08 8:16
Lea Hayes26-Dec-08 8:16 
Generalinsert images in rtf file Pin
panoskatws20-Apr-08 7:30
panoskatws20-Apr-08 7:30 
GeneralRe: insert images in rtf file Pin
mav.northwind20-Apr-08 7:44
mav.northwind20-Apr-08 7:44 
GeneralLoading an Icon Resource [modified] Pin
#realJSOP20-Apr-08 4:35
mve#realJSOP20-Apr-08 4:35 
GeneralRe: Loading an Icon Resource Pin
Scott Dorman20-Apr-08 4:50
professionalScott Dorman20-Apr-08 4:50 
GeneralRe: Loading an Icon Resource Pin
#realJSOP20-Apr-08 5:07
mve#realJSOP20-Apr-08 5:07 
GeneralRe: Loading an Icon Resource Pin
Scott Dorman20-Apr-08 5:14
professionalScott Dorman20-Apr-08 5:14 
GeneralRe: Loading an Icon Resource Pin
#realJSOP20-Apr-08 5:41
mve#realJSOP20-Apr-08 5:41 
GeneralRe: Loading an Icon Resource Pin
Scott Dorman20-Apr-08 6:44
professionalScott Dorman20-Apr-08 6:44 
QuestionSorting data using BindingSource.Sort Pin
Alessandra7720-Apr-08 4:04
Alessandra7720-Apr-08 4:04 

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.