private void startNewAuth() { var nonceStore = Util.GetNonceStore(); var certAuth = new PKCertificateAuthentication(nonceStore); var nonce = certAuth.Start(); NonceField.Value = Convert.ToBase64String(nonce); DigestAlgorithmField.Value = PKCertificateAuthentication.DigestAlgorithm.Oid; }
protected void SubmitButton_Click(object sender, EventArgs e) { var nonceStore = Util.GetNonceStore(); var certAuth = new PKCertificateAuthentication(nonceStore); PKCertificate certificate; var vr = certAuth.Complete(Convert.FromBase64String(NonceField.Value), Convert.FromBase64String(CertificateField.Value), Convert.FromBase64String(SignatureField.Value), Util.GetTrustArbitrator(), out certificate); if (!vr.IsValid) { vr.Errors.ForEach(ve => ModelState.AddModelError("", ve.ToString())); startNewAuth(); return; } this.AuthenticatedCertificate = certificate; this.ValidationResults = vr; Server.Transfer("AuthenticationSuccess.aspx"); }