Get list of certificates from the certificate store in C#

后端 未结 4 1511
情歌与酒
情歌与酒 2020-11-29 03:57

For a secure application I need to select a certificate in a dialog. How can I access certificate store or a part of it (e.g. storeLocation=\"Local Machine\" an

4条回答
  •  误落风尘
    2020-11-29 04:38

    X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
    
    store.Open(OpenFlags.ReadOnly);
    
    foreach (X509Certificate2 certificate in store.Certificates){
        //TODO's
    }
    

提交回复
热议问题