Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: ListViews: Sort ascending/descending Pin
Furty3-Sep-03 20:08
Furty3-Sep-03 20:08 
GeneralRe: ListViews: Sort ascending/descending Pin
tsigo6-Sep-03 11:00
tsigo6-Sep-03 11:00 
GeneralObtaining Caller of a Method in C# Pin
TheLastBastion3-Sep-03 9:21
TheLastBastion3-Sep-03 9:21 
GeneralRe: Obtaining Caller of a Method in C# Pin
leppie3-Sep-03 10:16
leppie3-Sep-03 10:16 
GeneralRe: Obtaining Caller of a Method in C# Pin
James Simpson3-Sep-03 10:28
James Simpson3-Sep-03 10:28 
GeneralRe: Obtaining Caller of a Method in C# Pin
leppie3-Sep-03 13:33
leppie3-Sep-03 13:33 
GeneralRe: Obtaining Caller of a Method in C# Pin
James T. Johnson3-Sep-03 14:32
James T. Johnson3-Sep-03 14:32 
GeneralRe: Obtaining Caller of a Method in C# Pin
Jerry Dennany3-Sep-03 14:34
Jerry Dennany3-Sep-03 14:34 
GeneralPInvoke Pin
Anonymous3-Sep-03 9:17
Anonymous3-Sep-03 9:17 
GeneralDesign Patterns - on a mission. Pin
Aroogala3-Sep-03 6:58
Aroogala3-Sep-03 6:58 
GeneralRe: Design Patterns - on a mission. Pin
Anonymous3-Sep-03 7:37
Anonymous3-Sep-03 7:37 
GeneralRe: Design Patterns - on a mission. Pin
Jim Stewart4-Sep-03 3:27
Jim Stewart4-Sep-03 3:27 
GeneralOleDbException: Multiple-step OLE DB operation generated errors. Pin
mikemilano3-Sep-03 6:41
mikemilano3-Sep-03 6:41 
GeneralVB script to C# Pin
Majid Shahabfar3-Sep-03 4:35
Majid Shahabfar3-Sep-03 4:35 
GeneralRe: VB script to C# Pin
Alvaro Mendez3-Sep-03 6:29
Alvaro Mendez3-Sep-03 6:29 
GeneralRe: VB script to C# Pin
Majid Shahabfar3-Sep-03 19:03
Majid Shahabfar3-Sep-03 19:03 
GeneralRe: VB script to C# Pin
Corinna John4-Sep-03 2:00
Corinna John4-Sep-03 2:00 
GeneralRe: VB script to C# Pin
Majid Shahabfar6-Sep-03 3:42
Majid Shahabfar6-Sep-03 3:42 
GeneralRe: VB script to C# Pin
Richard Deeming5-Sep-03 8:05
mveRichard Deeming5-Sep-03 8:05 
GeneralRe: VB script to C# Pin
Majid Shahabfar6-Sep-03 3:43
Majid Shahabfar6-Sep-03 3:43 
GeneralRe: VB script to C# Pin
dog_spawn3-Sep-03 7:04
dog_spawn3-Sep-03 7:04 
QuestionRSA public key? Pin
ravingcoder3-Sep-03 4:05
ravingcoder3-Sep-03 4:05 
Hi, trying to encrypt something using RSAServiceProvide. I have two problems.

1. Bad data when decrypting.

(1) In prototype, RSA_Server instance in decrypting side and encrypting side is the same instance. Of course, this will change later.

RSAServiceProvider RSA_Server;

(2) On encrypting side:
RSA_Server = new RSACryptoServiceProvider();

encryptedbuffer = RSA_Server.Encrypt(
databuffer,
false);

NOTE: At first I was suspecting that databuffer is than 5 bytes. But I get same problem after I trimmed databuffer down to one bytes. Anyway, here's quote from MSDN:

"The length of the rgb parameter is greater than the maximum allowed length. If the fOAEP parameter is false and the encryption is performed on a computer with the high encryption pack installed, the maximum length of the rgb parameter is 16 bytes. If the high encryption pack is not installed, the maximum length of the rgb parameter is 5 bytes."

(3) On decrypting side:

plaintext = RSA_Server.Decrypt(encryptedbuffer, false);



2. How can I retrieve private key from RSAParameters instance? I need to "publish" my public key - not the entire RSAParameters. Here's code from MSDN:

//Good. PublicKey and "Exponent" are both byte array.
byte[] PublicKey = {214,46,220,83,160,73,40,39,201,155,19,202,3,11,191,178,56,
74,90,36,248,103,18,144,170,163,145,87,54,61,34,220,222,
207,137,149,173,14,92,120,206,222,158,28,40,24,30,16,175,
108,128,35,230,118,40,121,113,125,216,130,11,24,90,48,194,
240,105,44,76,34,57,249,228,125,80,38,9,136,29,117,207,139,
168,181,85,137,126,10,126,242,120,247,121,8,100,12,201,171,
38,226,193,180,190,117,177,87,143,242,213,11,44,180,113,93,
106,99,179,68,175,211,164,116,64,148,226,254,172,147};

byte[] Exponent = {1,0,1};


//Create a new instance of RSACryptoServiceProvider.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

//Create a new instance of RSAParameters.
RSAParameters RSAKeyInfo = new RSAParameters();

//Set RSAKeyInfo to the public key values.
RSAKeyInfo.Modulus = PublicKey; <--- OKAY, that's your public key.
RSAKeyInfo.Exponent = Exponent; <--- what da? Is this your private key?

//Import key parameters into RSA.
RSA.ImportParameters(RSAKeyInfo);

I need to pass encrypted data + RSA public key to decrypting side.

Thanks.
AnswerRe: RSA public key? Pin
ravingcoder3-Sep-03 17:12
ravingcoder3-Sep-03 17:12 
QuestionHow can we prevent a C++ Class from inheritance? Pin
sri sankaradoss3-Sep-03 1:59
sri sankaradoss3-Sep-03 1:59 
AnswerRe: How can we prevent a C++ Class from inheritance? Pin
Alvaro Mendez3-Sep-03 6:24
Alvaro Mendez3-Sep-03 6:24 

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.