On Fri, Mar 4, 2011 at 12:24 AM, diegocairone <[email protected]> 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 - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
