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
How I Make Money Blogging + How to Monetize a New Blog — TaylorStanford.com
7 Blog Niches That Make Money and Get Traffic - Blogging Her Way
Is Paige Vanzant Related To Ronnie Van Zant
Login Page
Greedfall Console Commands
Unblocked Games Premium Worlds Hardest Game
Meer klaarheid bij toewijzing rechter
Chelsea player who left on a free is now worth more than Palmer & Caicedo
Sissy Hypno Gif
Meg 2: The Trench Showtimes Near Phoenix Theatres Laurel Park
Pbr Wisconsin Baseball
2013 Chevy Cruze Coolant Hose Diagram
Ree Marie Centerfold
Readyset Ochsner.org
Bestellung Ahrefs
Evil Dead Rise Showtimes Near Regal Columbiana Grande
Dump Trucks in Netherlands for sale - used and new - TrucksNL
Darksteel Plate Deepwoken
Overton Funeral Home Waterloo Iowa
Nba Rotogrinders Starting Lineups
Tnt Forum Activeboard
Spectrum Field Tech Salary
Me Cojo A Mama Borracha
Tyler Sis University City
What Channel Is Court Tv On Verizon Fios
Stoney's Pizza & Gaming Parlor Danville Menu
SuperPay.Me Review 2023 | Legitimate and user-friendly
Greenville Sc Greyhound
Dei Ebill
Preggophili
Paris Immobilier - craigslist
Craigslist Rentals Coquille Oregon
Cable Cove Whale Watching
Vht Shortener
Spirited Showtimes Near Marcus Twin Creek Cinema
Blush Bootcamp Olathe
6465319333
Uhaul Park Merced
Free Robux Without Downloading Apps
Toonily The Carry
Delaware judge sets Twitter, Elon Musk trial for October
Los Garroberros Menu
Wo ein Pfand ist, ist auch Einweg
3500 Orchard Place
Gt500 Forums
Vci Classified Paducah
Gonzalo Lira Net Worth
Gander Mountain Mastercard Login
Sc Pick 3 Past 30 Days Midday
Sams Gas Price San Angelo
Craigslist Psl
Arnold Swansinger Family
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.