인증서를 추가하려고하는데 Add 함수가 아무 것도하지 않는 것 같습니다.x509Store에 인증서를 추가해도 아무 것도 수행되지 않습니다. C#
두 개의 인증서가 있습니다. 둘 다 나는 오른쪽 클릭하고 개인 "testStore"저장소에 저장하여 수동으로 추가 할 수 있지만 프로그래밍 방식으로 추가하려고하면 저장되지 않습니다. 나는 그 중 하나만 추가했고, X509Store 객체에는 예상대로 포함되어 있지만 .Add (cert)를 호출하면 아무것도 저장되지 않습니다.
//I've already added 1 cert manually
X509Certificate2 cert2 = new X509Certificate2(@"C:\temp\Cert2.cer");
X509Store store = new X509Store("testStore", StoreLocation.CurrentUser);
store.Open(OpenFlags.MaxAllowed);
//here store.Certificates has the one Certificate I added manually as expected.
store.Certificates.Add(cert2);
//here store.Certificates still only has the first certificate, cert2 still isn't there..
store.Close();
내가 누락 된 상품이 있습니까? 편집
는 또한 (아래로) StorePermission를 사용하여 시도 또한 관리자 계정을 가장하는 시도하고 그 중 하나를
StorePermission sp = new StorePermission(PermissionState.Unrestricted);
sp.Flags = StorePermissionFlags.AllFlags;
sp.Assert();
나는 그것을 시도했지만 도움이되지 않았습니다. – user3652261