System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters
"Mauricio Grimberg" <mau@mug.org.ar> wrote in message
news:OZ$IwvkjFHA.2852@TK2MSFTNGP15.phx.gbl...
> Thanks people, you are really helping me.
> Let's fight :)
>
> "Michel Gallant" <neutron@istar.ca> wrote in message
> news:%23i89dchjFHA.1416@TK2MSFTNGP09.phx.gbl...
>> Yes that is correct. The exponent is a binary number (as is the modulus).
>> Don't confuse the b64 encoding of the character 3 (which would actually
>> give Mw== )
>> with the binary byte 3.
>> - Mitch
>>
>> "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com>
>> wrote in message news:upTghMhjFHA.3580@TK2MSFTNGP09.phx.gbl...
>>> If it is a single byte, then a byte array containing that single byte
>>> converted to Base64 would be Aw==, so I don't necessarily see the
>>> problem.
>>>
>>> Joe K.
>>>
>>> "Mauricio Grimberg" <mau@mug.org.ar> wrote in message
>>> news:O%23Ir9AhjFHA.572@TK2MSFTNGP15.phx.gbl...
>>>> I'm near :)
>>>> My problem is the Exponent: publicExponent: 3 (0x3)
>>>> Using Convert.ToBase64String the number 3 gives me "Aw==", or using 3
>>>> (0x3) "MA=="
>>>> Mmmm......
>>>>
>>>> "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com>
>>>> wrote in message news:%23GMMOWXjFHA.3436@tk2msftngp13.phx.gbl...
>>>>> You would need to parse the open SSL hex dump to get it into a byte
>>>>> array. Once you have a byte array, you just call
>>>>> Convert.ToBase64String.
>>>>>
>>>>> Looping through the hex string and using Byte.Parse should work fine.
>>>>>
>>>>> Also, be careful about "endian" issues. One implementation may be
>>>>> expecting the key in reverse order from the other. :)
>>>>>
>>>>> Joe K.
>>>>>
>>>>> "Mauricio Grimberg" <mau@mug.org.ar> wrote in message
>>>>> news:u$m3UeUjFHA.1416@TK2MSFTNGP09.phx.gbl...
>>>>>> Is there a .net way to go from the hex in openssl (00:d5:80 ..) and
>>>>>> 3 (0x3)
>>>>>> to the b64 in .net?
>>>>>>
>>>>>> "Michel Gallant" <neutron@istar.ca> wrote in message
>>>>>> news:OkUacTUjFHA.2444@tk2msftngp13.phx.gbl...
>>>>>>> The dirst dump (00:d5:80 ..) is a hex dump for a 512 bit key
>>>>>>>
>>>>>>> The .NET <Modulus> 2azk.. dump is a b64 representation of
>>>>>>> a different (obviously) 1024 bit RSA modulus.
>>>>>>> The exponent, AQAB (in b64) is the most common RSA public exponent,
>>>>>>> or in hex 01:00:01 or 65537 decimal.
>>>>>>>
>>>>>>> - Mitch
>>>>>>>
>>>>>>> "Mauricio Grimberg" <mau@mug.org.ar> wrote in message
>>>>>>> news:O3nnj5TjFHA.576@tk2msftngp13.phx.gbl...
>>>>>>>> I tried with openssl and the library got for me the parameters but
>>>>>>>> the info
>>>>>>>> in each parameter is not intelligible for me.
>>>>>>>> As an example:
>>>>>>>> modulus:
>>>>>>>> 00:d5:80:89:03:33:5f:44:32:25:c6:49:5d:88:83:
>>>>>>>> 5d:f9:28:88:12:2c:bc:26:0d:b9:dc:e1:03:20:cc:
>>>>>>>> f2:2f:a0:ae:33:d2:f2:ff:69:71:92:03:6f:9d:3e:
>>>>>>>> ad:55:27:d0:ba:0b:71:10:16:cf:d7:44:1f:73:f8:
>>>>>>>> b6:41:7f:56:23
>>>>>>>> publicExponent: 3 (0x3)
>>>>>>>>
>>>>>>>> I should wait something more like this:
>>>>>>>>
>>>>>>>>
>>>>>>> <Modulus>2azkR5n3jzWQzpa/ukMjiVFhehgZyIMfcrgMBsJr260lLcX6Sr7lnWr4tapN8HQAW0HLIM6bn6h0Nk1Do0oiRGMG1Mj0+P5yaIHqYT0tCRem1A4xVfCfTrYzdOz
>>>>>>> pudkGrYdtk8MAjqI2JK1QQWW5LDQ21Xj/oqYO06TANeLcmns=</Modulus>
>>>>>>>>
>>>>>>>> <Exponent>AQAB</Exponent>
>>>>>>>>
>>>>>>>> I'm fightingth, thanks :)
>>>>>>>>
>>>>>>>> "Michel Gallant" <neutron@istar.ca> wrote in message
>>>>>>>> news:uX%23P5gLjFHA.3336@TK2MSFTNGP10.phx.gbl...
>>>>>>>> > The PrivateKeyInfo format is not accessible directly from
>>>>>>>> > .NET 1.1 or 2.
>>>>>>>> > You could P/Invoke using CryptImportPKCS8(..) and similar which
>>>>>>>> > is
>>>>>>>> > a bit awkward .. because that imports into a CSP and then you
>>>>>>>> > need to get the parameters from there ..
>>>>>>>> >
>>>>>>>> > See also, the PKCS#8 PrivateKeyInfo (unfortunately in Java which
>>>>>>>> > has
>>>>>>>> > fairly good support for PKCS#8 :-)
>>>>>>>> > to capi PRIVATEKEYBLOB converter here:
>>>>>>>> >
http://www.jensign.com/JavaScience/PvkConvert >>>>>>>> > - Mitch
>>>>>>>> >
>>>>>>>> > "Mauricio Grimberg" <mau@mug.org.ar> wrote in message
>>>>>>>> > news:uTVrYTLjFHA.1444@TK2MSFTNGP10.phx.gbl...
>>>>>>>> >> It seems to be [Private Key (Traditional SSLeay RSAPrivateKey
>>>>>>>> >> format)
>>>>>>>> >> Encrypted:
>>>>>>>> >> -----BEGIN RSA PRIVATE KEY-----
>>>>>>>> >> Proc-Type: 4,ENCRYPTED
>>>>>>>> >> DEK-Info: DES-EDE3-CBC,24A667C253F8A1B9]
>>>>>>>> >>
>>>>>>>> >> Something like -----BEGIN RSA PRIVATE KEY-----
>>>>>>>> >> MIIBOwIBLABLATheFollowing==
>>>>>>>> >> -----END RSA PRIVATE KEY-----
>>>>>>>> >> Thanks in advance.
>>>>>>>> >>
>>>>>>>> >> "Michel Gallant" <neutron@istar.ca> wrote in message
>>>>>>>> >> news:ueJ45jKjFHA.1232@TK2MSFTNGP15.phx.gbl...
>>>>>>>> >> > Which type of key? public key, private key, encrypted private
>>>>>>>> >> > key?
>>>>>>>> >> > See here for a start:
>>>>>>>> >> >
http://www.jensign.com/JavaScience/PEM/pemformats.txt >>>>>>>> >> >
>>>>>>>> >> > - Mitch Gallant
>>>>>>>> >> > MVP Security
>>>>>>>> >> >
>>>>>>>> >> > "Mauricio Grimberg" <mau@mug.org.ar> wrote in message
>>>>>>>> >> > news:%23cOCS7GjFHA.1372@TK2MSFTNGP10.phx.gbl...
>>>>>>>> >> >> Hi people: I must load a RSA object from a .PEM file.
>>>>>>>> >> >> It seems not to be trivial.
>>>>>>>> >> >> I suppose I must obtain the RSAParameters from the file but I
>>>>>>>> >> >> really
>>>>>>>> >> >> don't
>>>>>>>> >> >> know how.
>>>>>>>> >> >>
>>>>>>>> >> >> Mauricio Grimberg
>>>>>>>> >> >>
>>>>>>>> >> >>
>>>>>>>> >> >
>>>>>>>> >> >
>>>>>>>> >>
>>>>>>>> >>
>>>>>>>> >
>>>>>>>> >
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>