Fetching contributors…
Cannot retrieve contributors at this time
35 lines (25 sloc) 2.2 KB
title dev_langs helpviewer_keywords ms.assetid
How to: Consistently Reference X.509 Certificates
certificates [WCF], referencing X.509 certificates

How to: Consistently Reference X.509 Certificates

You can identify a certificate in several ways: by the hash of the certificate, by the issuer and serial number, or by the subject key identifier (SKI). The SKI provides a unique identification for the certificate's subject public key and is often used when working with XML digital signing. The SKI value is usually part of the X.509 certificate as an X.509 certificate extension. Windows Communication Foundation (WCF) has a default referencing style that uses the issuer and serial number if the SKI extension is missing from the certificate. If the certificate contains the SKI extension, the default referencing style uses the SKI to point to the certificate. If mid-way through development of an application, you switch from using certificates that do not use the SKI extension to certificates that use the SKI extension, the referencing style used in WCF-generated messages also changes.

If a consistent referencing style is required regardless of SKI extension presence, it is possible to configure the desired referencing style as shown in the following code.


The following example creates a custom security binding element that uses a single consistent referencing style, the issuer name and serial number.

[!code-csharpc_ReferencingCertificatesConsistently#1] [!code-vbc_ReferencingCertificatesConsistently#1]

Compiling the Code

The following namespaces are required to compile the code:

  • xref:System

  • xref:System.ServiceModel

  • xref:System.ServiceModel.Channels

  • xref:System.ServiceModel.Security.Tokens

See Also

Working with Certificates