Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
General.NET crypto Pin
devvvy27-Aug-03 8:01
devvvy27-Aug-03 8:01 
GeneralRe: .NET crypto Pin
David Stone27-Aug-03 11:19
sitebuilderDavid Stone27-Aug-03 11:19 
GeneralRe: .NET crypto Pin
devvvy27-Aug-03 13:18
devvvy27-Aug-03 13:18 
GeneralRe: .NET crypto Pin
devvvy27-Aug-03 13:35
devvvy27-Aug-03 13:35 
GeneralRe: .NET crypto Pin
devvvy27-Aug-03 13:38
devvvy27-Aug-03 13:38 
GeneralRe: .NET crypto Pin
David Stone27-Aug-03 20:38
sitebuilderDavid Stone27-Aug-03 20:38 
GeneralRe: .NET crypto Pin
David Stone27-Aug-03 20:31
sitebuilderDavid Stone27-Aug-03 20:31 
GeneralRe: .NET crypto Pin
David Stone27-Aug-03 20:24
sitebuilderDavid Stone27-Aug-03 20:24 
norm wrote:
STEP 1: say once you have determined the legal size:
max 128
min 16
skip 16
STEP 2: Your key legal size is therefore: {16, 32, 48, 56... 128}


No, you're mistaking the size for the possible values. The size is the length of that array. The possible values for System.Byte are still going to be 0 to 255. That just means that the legal key size has to be an array with between 16 bytes and 128 bytes in it.

norm wrote:
STEP 4: 56 bits = 4 x16bits = 4 HEX number = {HEX1, HEX2, HEX3, HEX4} (Is this correct?)

Again, no, you're mistaking the possible values in the array for the length of the array.

norm wrote:
QUESTION 2:
Also, instead of:

byte[] MyKey = {0x10, 0x12, 0x0A, 0x3B}

Could I have generated it programmatically? Or can I load a key from a key file generated by sn.exe?


Yes! In fact, that's what I always do. I usually do something like this:

string myPassword<br />
byte[] passBytes = System.Text.Encoding.Default.GetBytes(myPassword);


And then I take passBytes, trim it down to the legal size (actually, it always fits within the legal size for RSA), and then give that to the RSA CSP. As for pulling from an sn.exe generated file, sure. I don't see why not, especially since that's generated (I believe) for RSA.

norm wrote:
QUESTION 3:
Do I have to rely on CryptoAPI to gain access to a key in cert store - and perhaps all other tasks that has to do with cert store?


No. I don't believe so. At least that's not what they say http://www.gotdotnet.com/team/clr/cryptofaq.htm[^]:

10. Does the crypto library have a key management system different from CryptoAPI?

No, we internally use CryptoAPI key storage and you can reference keys stored in CryptoAPI key containers by using the CspParameters object. For a sample of how to store and retrieve your own asymmetric key pair in CryptoAPI key storage see the sample on www.gotdotnet.com/team/clr/about_security.aspx.


However, I couldn't find that sample. You may have to go hunting in the MSDN docs. Although, the most valuable thing I saw on that "Sample" page was this:

The Source Code for the .NET Framework Cryptography Classes[^] Cool | :cool:


I passionately hate the idea of being with it, I think an artist has always to be out of step with his time.
-Orson Welles

GeneralRe: .NET crypto Pin
devvvy28-Aug-03 0:34
devvvy28-Aug-03 0:34 
GeneralRe: .NET crypto Pin
David Stone28-Aug-03 9:06
sitebuilderDavid Stone28-Aug-03 9:06 
GeneralExtract Heading from a word doc Pin
kanch eramudu27-Aug-03 5:29
kanch eramudu27-Aug-03 5:29 
GeneralAttachment with Outlook express Pin
Velichko Sarev27-Aug-03 1:53
Velichko Sarev27-Aug-03 1:53 
GeneralAdministrator Privileges Pin
Manoj_kr7427-Aug-03 0:42
Manoj_kr7427-Aug-03 0:42 
GeneralRe: Administrator Privileges Pin
Kannan Kalyanaraman27-Aug-03 1:11
Kannan Kalyanaraman27-Aug-03 1:11 
GeneralRe: Administrator Privileges Pin
Mazdak27-Aug-03 8:51
Mazdak27-Aug-03 8:51 
Generalstore users settings Pin
Member 50926226-Aug-03 23:30
Member 50926226-Aug-03 23:30 
GeneralRe: store users settings Pin
Kannan Kalyanaraman27-Aug-03 1:19
Kannan Kalyanaraman27-Aug-03 1:19 
GeneralRe: store users settings Pin
Member 50926227-Aug-03 10:47
Member 50926227-Aug-03 10:47 
GeneralRe: store users settings Pin
Nick Parker27-Aug-03 6:03
protectorNick Parker27-Aug-03 6:03 
GeneralRe: store users settings Pin
Frank Olorin Rizzi28-Aug-03 1:37
Frank Olorin Rizzi28-Aug-03 1:37 
QuestionHow to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin26-Aug-03 21:25
Eric Marchesin26-Aug-03 21:25 
AnswerRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Kannan Kalyanaraman27-Aug-03 1:21
Kannan Kalyanaraman27-Aug-03 1:21 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin27-Aug-03 2:02
Eric Marchesin27-Aug-03 2:02 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
leppie27-Aug-03 10:30
leppie27-Aug-03 10:30 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin27-Aug-03 23:54
Eric Marchesin27-Aug-03 23:54 

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.