[Mono-list] cryptografy with Mono - works with DOTNET, fails with MONO

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Mar 8 08:29:26 EST 2011


Diego,

The System.Security.Cryptography.Pkcs namespace was never completed.
Some stuff will work, others wont. Some missing features would require
only a bit of work, others would require a lot.

Please fill a bug report including a self-contained test case.

Sebastien

Le 2011-03-07 à 20:32, Tymek Majewski <tym.majewski at nearmap.com> a écrit :

> On Fri, Mar 4, 2011 at 12:24 AM, diegocairone <diego_cai at hotmail.com> wrote:
>> I have a problem running this code under Mono. The same code works OK under
>> DOTNET. What can I do?
>>
>> X509Certificate2 crt = new X509Certificate2();
>>
>> byte[] crtBytes = [ certificate in the format PKCS12 (certificate + private
>> key) obtained using FileStream class]
>>
>> crt.Import(crtBytes, "123456", X509KeyStorageFlags.DefaultKeySet);
>>
>> Encoding msgCodificado = Encoding.UTF8;
>> byte[] msgBytes = msgCodificado.GetBytes(xmlTRA.OuterXml); //
>> xmlTRA.OuterXml is the data to sign
>>
>> ContentInfo pkcsContentInfo = new ContentInfo(msgBytes);
>> SignedCms cms = new SignedCms(pkcsContentInfo);
>> CmsSigner firmante = new CmsSigner(crt);
>>
>> firmante.IncludeOption = X509IncludeOption.EndCertOnly;
>> cms.ComputeSignature(firmante); // ---> throw an cryptografy exception with
>> MONO
>>
>> byte[] firma = cms.Encode();
>> firmaB64 = Convert.ToBase64String(firma);
>>
>> I am using using:
>> System.Text;
>> using System.Security.Cryptography;
>> using System.Security.Cryptography.Pkcs;
>> using System.Security.Cryptography.X509Certificates;
>>
>> What can I do?
>> Thanks.
>
> Hi,
>
> If you post which version of Mono you used and exactly what the
> exception was (with the stack trace) you will get a meaningful answer
> quicker:)
>
>
> Cheers,
> Tymek Majewski
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


More information about the Mono-list mailing list