Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Simplest digital signing (See related posts)

            X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
            X509Certificate2Collection certs =
                X509Certificate2UI.SelectFromCollection(store.Certificates,
                    "Certificates", "Please select certificate to use", X509SelectionFlag.SingleSelection);

            CmsSigner cms = new CmsSigner(certs[0]);
            SignedCms sig = new SignedCms(new ContentInfo(new byte[10]));

            sig.ComputeSignature(cms, false); 

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts