How to: Consistently Reference X.509 Certificates - WCF (2024)

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.

Example

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

public Binding CreateClientBinding(){ AsymmetricSecurityBindingElement abe = (AsymmetricSecurityBindingElement)SecurityBindingElement. CreateMutualCertificateBindingElement( MessageSecurityVersion. WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10); abe.SetKeyDerivation(false); X509SecurityTokenParameters istp = abe.InitiatorTokenParameters as X509SecurityTokenParameters; if (istp != null) { istp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial; } X509SecurityTokenParameters rstp = abe.RecipientTokenParameters as X509SecurityTokenParameters; if (rstp != null) { rstp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial; } HttpTransportBindingElement transport = new HttpTransportBindingElement(); return new CustomBinding(abe, transport);}
Public Function CreateClientBinding() As Binding Dim abe As AsymmetricSecurityBindingElement = CType(SecurityBindingElement.CreateMutualCertificateDuplexBindingElement _ (MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10), _ AsymmetricSecurityBindingElement) abe.SetKeyDerivation(False) Dim istp As X509SecurityTokenParameters = TryCast(abe.InitiatorTokenParameters, X509SecurityTokenParameters) If istp IsNot Nothing Then istp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial End If Dim rstp As X509SecurityTokenParameters = TryCast(abe.RecipientTokenParameters, X509SecurityTokenParameters) If rstp IsNot Nothing Then rstp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial End If Return New CustomBinding(abe, New HttpTransportBindingElement())End Function

Compiling the Code

The following namespaces are required to compile the code:

See also

How to: Consistently Reference X.509 Certificates - WCF (2024)
Top Articles
Carte bancaire bloquée à l'étranger - Crédit Agricole
Send Money to India from Nigeria
Skigebiet Portillo - Skiurlaub - Skifahren - Testberichte
Moon Stone Pokemon Heart Gold
4-Hour Private ATV Riding Experience in Adirondacks 2024 on Cool Destinations
Lifebridge Healthstream
How To Be A Reseller: Heather Hooks Is Hooked On Pickin’ - Seeking Connection: Life Is Like A Crossword Puzzle
Directions To 401 East Chestnut Street Louisville Kentucky
Farmers Branch Isd Calendar
Optimal Perks Rs3
Parks in Wien gesperrt
THE 10 BEST River Retreats for 2024/2025
Umn Biology
Ucf Event Calendar
Tiraj Bòlèt Florida Soir
Oriellys St James Mn
Unit 1 Lesson 5 Practice Problems Answer Key
Syracuse Jr High Home Page
Driving Directions To Atlanta
Bowie Tx Craigslist
Download Center | Habasit
Danforth's Port Jefferson
Menards Eau Claire Weekly Ad
Bekijk ons gevarieerde aanbod occasions in Oss.
O'Reilly Auto Parts - Mathis, TX - Nextdoor
Sussyclassroom
6 Most Trusted Pheromone perfumes of 2024 for Winning Over Women
By.association.only - Watsonville - Book Online - Prices, Reviews, Photos
Himekishi Ga Classmate Raw
Makemkv Key April 2023
Audi Q3 | 2023 - 2024 | De Waal Autogroep
Diana Lolalytics
Compress PDF - quick, online, free
Linabelfiore Of
Rogers Centre is getting a $300M reno. Here's what the Blue Jays ballpark will look like | CBC News
Frcp 47
Wo ein Pfand ist, ist auch Einweg
Alston – Travel guide at Wikivoyage
Unblocked Games - Gun Mayhem
Youravon Com Mi Cuenta
Greatpeople.me Login Schedule
Server Jobs Near
Craigslist Free Cats Near Me
Sleep Outfitters Springhurst
Skyward Login Wylie Isd
2487872771
Spongebob Meme Pic
Southwind Village, Southend Village, Southwood Village, Supervision Of Alcohol Sales In Church And Village Halls
OSF OnCall Urgent Care treats minor illnesses and injuries
Haunted Mansion Showtimes Near The Grand 14 - Ambassador
Noaa Duluth Mn
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6192

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.