I am trying to develop an ASP.net site that reads ClientCertificate to ensure that a smart card is used to access the website (attempt to end username / password).
The process that is on my mind:
- The user registers the account, and C # the user client records. Certificate (publicly available).
- The user can then log in next time with the same client certificate, and now they are authenticated users if the hash is valid.
- I will use the code below to guarantee the authenticity of the certificate. The browser must deal with private keys and ensure that the certificate is NOT tampered with.
- Based on a combination of Subject + Certificate, C # assigns them its access to roles.
Can the following code be used to authenticate certificate authority?
X509Certificate x509Cert = new X509Certificate(Request.ClientCertificate.Certificate);
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] hashvalue = sha.ComputeHash(Request.ClientCertificate.Certificate);
byte[] x509Hash = x509Cert.GetCertHash();
Is this how the SmartCard authentication process should work?
source
share