Getting the X509Certificate Serial Number out of the ClaimSet

The ClaimSet is quite interesting and extracting the Serial number from the certificate was something that wasn't that straight forward using FindClaims which takes the ClaimType Enumerator. For this you can cast the claim set into a X509CertificateClaimSet and get the Serial Number

        public string GetCertificateSerialNumber()
        {
            foreach (ClaimSet cs in OperationContext.Current.ServiceSecurityContext.AuthorizationContext.ClaimSets)
                if (cs is X509CertificateClaimSet)
                    return ((X509CertificateClaimSet)cs).SerialNumber;

            return null;
        }