



If we want to use the client cert in an ASP.NET app, we may use something like this instead: X509Certificate2 cert = new X509Certificate2(certPath) Load the certificate we'll use to verify the signature from a file Static bool Verify(string text, byte signature, string certPath)

Return csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA1")) UnicodeEncoding encoding = new UnicodeEncoding() Throw new Exception("No valid cert was found") Get its associated CSP and private keyĬsp = (RSACryptoServiceProvider)cert.PrivateKey Find the certificate we'll use to signįoreach (X509Certificate2 cert in my.Certificates) X509Store my = new X509Store(StoreName.My, StoreLocation.CurrentUser) Access Personal (MY) certificate store of current user Static byte Sign(string text, string certSubject) ASP.NET) (both will onlyhave public key associated to them). WinForms) applications or a client certificate (for i.e. Today I'm posting a sample which shows how to sign a text with a certificate in my Personal store (this cert will have public and private key associated to it) and how to verify that signature with a.
