EndpointIdentity.CreateRsaIdentity Método

Definición

Crea una identidad RSA.Creates an RSA identity.

Sobrecargas

CreateRsaIdentity(X509Certificate2)

Crea una identidad RSA con el certificado X.509 especificado.Creates an RSA identity with the specified X.509 certificate.

CreateRsaIdentity(String)

Crea una identidad RSA con la clave pública especificada.Creates an RSA identity with the specified public key.

Comentarios

Un cliente WCF seguro que se conecta a un punto de conexión con esta identidad comprueba que las notificaciones presentadas por el servidor contienen una notificación que incluye la clave pública RSA utilizada para construir esta identidad.A secure WCF client that connects to an endpoint with this identity verifies that the claims presented by the server contain a claim that contains the RSA public key used to construct this identity.

Uno de estos métodos estáticos crea una instancia de RsaEndpointIdentity llamando a su constructor RsaEndpointIdentity.One of these static methods creates an instance of RsaEndpointIdentity by calling its constructor RsaEndpointIdentity.

CreateRsaIdentity(X509Certificate2)

Crea una identidad RSA con el certificado X.509 especificado.Creates an RSA identity with the specified X.509 certificate.

public:
 static System::ServiceModel::EndpointIdentity ^ CreateRsaIdentity(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate);
public static System.ServiceModel.EndpointIdentity CreateRsaIdentity (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);
static member CreateRsaIdentity : System.Security.Cryptography.X509Certificates.X509Certificate2 -> System.ServiceModel.EndpointIdentity
Public Shared Function CreateRsaIdentity (certificate As X509Certificate2) As EndpointIdentity

Parámetros

certificate
X509Certificate2

X509Certificate2 que contiene el certificado para la identidad RSA.An X509Certificate2 that contains the certificate for the RSA identity.

Devoluciones

EndpointIdentity

RSA EndpointIdentity asociado con el certificate especificado.An RSA EndpointIdentity associated with the specified certificate.

Excepciones

certificate es null.certificate is null.

certificate no es un certificado de RSA.certificate is not an RSA certificate.

Ejemplos

El siguiente código muestra cómo llamar a este método.The following code shows how to call this method.

public static void CreateRSAIdentity()
{
    // Create a ServiceHost for the CalculatorService type. Base Address is supplied in app.config.
    using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService)))
    {
        // The base address is read from the app.config.
        Uri dnsrelativeAddress = new Uri(serviceHost.BaseAddresses[0], "dnsidentity");
        Uri certificaterelativeAddress = new Uri(serviceHost.BaseAddresses[0], "certificateidentity");
        Uri rsarelativeAddress = new Uri(serviceHost.BaseAddresses[0], "rsaidentity");

        // Set the service's X509Certificate to protect the messages.
        serviceHost.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine,
                                                                  StoreName.My,
                                                                  X509FindType.FindBySubjectDistinguishedName,
                                                                  "CN=identity.com, O=Contoso");
        //Cache a reference to the server's certificate.
        X509Certificate2 servercert = serviceHost.Credentials.ServiceCertificate.Certificate;

        //Create endpoints for the service using a WSHttpBinding set for anonymous clients.
        WSHttpBinding wsAnonbinding = new WSHttpBinding(SecurityMode.Message);
        //Clients are anonymous to the service.
        wsAnonbinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
        //Secure conversation (session) is turned off.
        wsAnonbinding.Security.Message.EstablishSecurityContext = false;

        //Create a service endpoint and change its identity to the DNS for an X509 Certificate.
        ServiceEndpoint ep = serviceHost.AddServiceEndpoint(typeof(ICalculator),
                                                            wsAnonbinding,
                                                            String.Empty);
        EndpointAddress epa = new EndpointAddress(dnsrelativeAddress, EndpointIdentity.CreateDnsIdentity("identity.com"));
        ep.Address = epa;

        //Create a service endpoint and change its identity to the X509 certificate's RSA key value.
        ServiceEndpoint ep3 = serviceHost.AddServiceEndpoint(typeof(ICalculator), wsAnonbinding, String.Empty);
        EndpointAddress epa3 = new EndpointAddress(rsarelativeAddress, EndpointIdentity.CreateRsaIdentity(servercert));
        ep3.Address = epa3;

Comentarios

Un cliente WCF seguro que se conecta a un punto de conexión con esta identidad comprueba que las notificaciones presentadas por el servidor contienen una notificación que contiene la clave pública RSA obtenida a partir del certificado utilizado para construir esta identidad.A secure WCF client that connects to an endpoint with this identity verifies that the claims presented by the server contain a claim that contains the RSA public key obtained from the certificate used to construct this identity.

Este método estático crea una instancia de RsaEndpointIdentity llamando a su constructor RsaEndpointIdentity.This static method creates an instance of RsaEndpointIdentity by calling its constructor, RsaEndpointIdentity.

Se aplica a

CreateRsaIdentity(String)

Crea una identidad RSA con la clave pública especificada.Creates an RSA identity with the specified public key.

public:
 static System::ServiceModel::EndpointIdentity ^ CreateRsaIdentity(System::String ^ publicKey);
public static System.ServiceModel.EndpointIdentity CreateRsaIdentity (string publicKey);
static member CreateRsaIdentity : string -> System.ServiceModel.EndpointIdentity
Public Shared Function CreateRsaIdentity (publicKey As String) As EndpointIdentity

Parámetros

publicKey
String

La clave pública para la identidad RSA.The public key for the RSA identity.

Devoluciones

EndpointIdentity

RSA EndpointIdentity asociado con el publicKey especificado.An RSA EndpointIdentity associated with the specified publicKey.

Excepciones

publicKey es null.publicKey is null.

Comentarios

Un cliente WCF seguro que se conecta a un punto de conexión con esta identidad comprueba que las notificaciones presentadas por el servidor contienen una notificación que incluye la clave pública RSA utilizada para construir esta identidad.A secure WCF client that connects to an endpoint with this identity verifies that the claims presented by the server contain a claim that contains the RSA public key used to construct this identity.

Este método estático crea una instancia de RsaEndpointIdentity llamando a su constructor RsaEndpointIdentity.This static method creates an instance of RsaEndpointIdentity by calling its constructor, RsaEndpointIdentity.

Se aplica a