C# 从netsh.exe获取证书

C# 从netsh.exe获取证书,c#,.net,https,certificate,window-server,C#,.net,Https,Certificate,Window Server,我们有一个使用https公开的WCF服务。通过在控制台中配置证书 netsh http add sslcert ipport=0.0.0.0:<port> certhash={<thumbprint>} appid={<some GUID>} 因此: IP:port : 0.0.0.0:54322 Certificate Hash : yyyyyyyyyyyyyyyyyyyy Applicat

我们有一个使用https公开的WCF服务。通过在控制台中配置证书

netsh http add sslcert ipport=0.0.0.0:<port> certhash={<thumbprint>} appid={<some GUID>}
因此:

IP:port                      : 0.0.0.0:54322
Certificate Hash             : yyyyyyyyyyyyyyyyyyyy
Application ID               : {xxxxxxxxxxxxxxxxx}
Certificate Store Name       : (null)
Verify Client Certificate Revocation : Enabled
Verify Revocation Using Cached Client Certificate Only : Disabled
Usage Check                  : Enabled
Revocation Freshness Time    : 0
URL Retrieval Timeout        : 0
Ctl Identifier               : (null)
Ctl Store Name               : (null)
DS Mapper Usage              : Disabled
Negotiate Client Certificate : Disabled
Reject Connections           : Disabled
Disable HTTP2                : Not Set
Disable QUIC                 : Not Set
Disable TLS1.3               : Not Set
Disable OCSP Stapling        : Not Set
我想对证书进行一些检查(有效期至、吊销等),但我找不到一个好的API来访问绑定信息。看起来这只在控制台中可用。我知道如何在证书存储中找到证书,但是我不想做字符串魔术来从输出中提取证书散列,因为我必须考虑使用不同语言运行的系统。
知道如何通过代码访问Windows机器上的SSL证书绑定吗?

请参阅GitHub项目:@jdweng:我已经尝试过了。它只是解析输出,然后创建一个具有dynamci属性的对象。不幸的是,这些都是本地化的,请参阅GitHub项目:@jdweng:我已经尝试过了。它只是解析输出,然后创建一个具有dynamci属性的对象。不幸的是,这些都是本地化的工具
IP:port                      : 0.0.0.0:54322
Certificate Hash             : yyyyyyyyyyyyyyyyyyyy
Application ID               : {xxxxxxxxxxxxxxxxx}
Certificate Store Name       : (null)
Verify Client Certificate Revocation : Enabled
Verify Revocation Using Cached Client Certificate Only : Disabled
Usage Check                  : Enabled
Revocation Freshness Time    : 0
URL Retrieval Timeout        : 0
Ctl Identifier               : (null)
Ctl Store Name               : (null)
DS Mapper Usage              : Disabled
Negotiate Client Certificate : Disabled
Reject Connections           : Disabled
Disable HTTP2                : Not Set
Disable QUIC                 : Not Set
Disable TLS1.3               : Not Set
Disable OCSP Stapling        : Not Set