X509SecurityTokenProvider CreateServerX509TokenProvider()
 {
     if (parent.ServiceCertificate.Certificate == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ServiceCertificateNotProvidedOnServiceCredentials)));
     }
     SecurityUtils.EnsureCertificateCanDoKeyExchange(parent.ServiceCertificate.Certificate);
     return(new ServiceX509SecurityTokenProvider(parent.ServiceCertificate.Certificate));
 }
Exemplo n.º 2
0
        X509SecurityToken ValidateX509Token(SecurityToken token)
        {
            X509SecurityToken result = token as X509SecurityToken;

            if (result == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.TokenProviderReturnedBadToken, token == null ? "<null>" : token.GetType().ToString())));
            }
            SecurityUtils.EnsureCertificateCanDoKeyExchange(result.Certificate);
            return(result);
        }