X509CertificateRecipientClientCredential.DefaultCertificate 属性

定义

获取或设置用于服务的默认证书。

public:
 property System::Security::Cryptography::X509Certificates::X509Certificate2 ^ DefaultCertificate { System::Security::Cryptography::X509Certificates::X509Certificate2 ^ get(); void set(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ value); };
public System.Security.Cryptography.X509Certificates.X509Certificate2 DefaultCertificate { get; set; }
member this.DefaultCertificate : System.Security.Cryptography.X509Certificates.X509Certificate2 with get, set
Public Property DefaultCertificate As X509Certificate2

属性值

X509Certificate2

用于服务的默认证书。

例外

试图在凭据为只读时进行设置。

示例

此代码演示如何访问该属性。

public void snippet24(CalculatorClient cc)
{
    X509CertificateRecipientClientCredential rcc = cc.ClientCredentials.ServiceCertificate;
    X509Certificate2 cert = rcc.DefaultCertificate;
}

注解

对于使用基于证书的消息安全的绑定,此证书用于加密发送给服务的消息,并期望服务用它来对客户端的应答进行签名。

适用于