문서에 서명 할 웹 응용 프로그램 (aspx/C#)에서 사용자 USB 키 (인증/서명 키)에있는 인증서를 나열하려면 어떻게합니까?X509Store - USB 키에있는 인증서를 나열하는 방법
여기 내 코드입니다 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Signature1
{
public partial class signature : System.Web.UI.Page
{
string strTxt = "Certificates : ";
protected void Page_Load(object sender, EventArgs e)
{
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
foreach (X509Certificate2 cert in store.Certificates)
{
strTxt += "\nDélivered to " + cert.SubjectName.Name + " by " + cert.IssuerName.Name;
}
store.Close();
myTextbox.Text = strTxt ;
}
}
}
이 코드는 로컬 컴퓨터 (디버그 모드)에 잘 작동하지만 응용 프로그램 서버에 게시 할 때 빈 목록을 반환합니다.
도움 주셔서 감사합니다.
PKCS # 11 인터페이스를 사용하면 ** 웹 응용 프로그램 **이 ** 클라이언트 컴퓨터 **의 LocalMachine 저장소에 액세스 할 수 있습니까? –
@ MristerB. 귀하의 질문을 잘못 읽은 것으로 보입니다 (연결된 원격 클라이언트 시스템에서 인증서를 읽으려는 것을 지정하지 않았기 때문에 잘못 읽은 것이 쉽습니다). 내 대답을 업데이트 할게. –