J'ai un profil de jeton de nom d'utilisateur fonctionnant en utilisant WCF, j'essaye d'ajouter le support pour le cryptage sur l'appel de client, le webservice attend un en-tête de savon crypté. J'ai installé un certificat dans mon magasin local en utilisant MMC. Dans mon code C# ci-dessous j'ai un code qui charge le certificat et l'assigne au proxy. Je ne suis pas sûr de ce que d'autres paramètres dont j'ai besoin dans mes liens personnalisés ou ce qui me manque dans mon code C#. Aucune suggestion?comment ajouter cryptage à l'en-tête de savon en utilisant un nom de jeton de nom d'utilisateur dans wcf
app.config:
<customBinding>
<binding name="cbinding">
<security authenticationMode="UserNameOverTransport" includeTimestamp="false">
<secureConversationBootstrap />
</security>
<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />
</binding>
<endpoint address="https://localhost:8443/p6ws/services/ProjectService?wsdl"
binding="customBinding" bindingConfiguration="cbinding" contract="P6.WCF.Project.ProjectPortType"
name="ProjectServiceEndPointCfg">
</endpoint>
Mon code C#:
ProjectPortTypeClient proxy = new ProjectPortTypeClient("ProjectServiceCertificateEndPointCfgUT", endpointAddress);
proxy.ClientCredentials.UserName.UserName = UserName;
proxy.ClientCredentials.UserName.Password= Password;
proxy.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust;
proxy.ClientCredentials.ServiceCertificate.Authentication.TrustedStoreLocation = System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine;
// Set the certificate
proxy.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByThumbprint, "13 d3 6e f1 26 5e 5f 74 be f2 bb f5 57 a4 47 cf e7 1a c6 0a");
proxy.ClientCredentials.ServiceCertificate.SetDefaultCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByThumbprint, "13 d3 6e f1 26 5e 5f 74 be f2 bb f5 57 a4 47 cf e7 1a c6 0a");
ReadProjects readProjects = new ReadProjects();
Je suis un consommateur du service Web, j'ai besoin de crypter l'en-tête de savon. Je l'ai déjà fonctionné avec HTTPS, mais j'ai besoin de faire fonctionner le protocole HTTP avec le chiffrement. – AZ49
@ user489100 Le lien que j'ai posté contient un code C# pour chiffrer le message soap. Le http chiffré est généralement https ... – rook
Y a-t-il une chance que vous ayez un lien pour cela en utilisant la politique WCF? – AZ49