惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
S
Securelist
博客园 - Franky
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Schneier on Security
Schneier on Security
Attack and Defense Labs
Attack and Defense Labs
Vercel News
Vercel News
腾讯CDC
Google DeepMind News
Google DeepMind News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
量子位
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
Cyberwarzone
Cyberwarzone
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News and Events Feed by Topic
T
Tenable Blog
PCI Perspectives
PCI Perspectives
MyScale Blog
MyScale Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
W
WeLiveSecurity
N
News | PayPal Newsroom
P
Proofpoint News Feed
O
OpenAI News
C
CERT Recently Published Vulnerability Notes
B
Blog
Cisco Talos Blog
Cisco Talos Blog
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Spread Privacy
Spread Privacy

博客园 - sig556

微信小程序开发需要注意的30个坑 数字证书制作及程序集签名 JAVA和android 环境配置 硬盘安装win2003 MongoDb使用 配置 Win7 和 IIS7 以支持WCF IIS+PHP ,apache+Php架设 - sig556 - 博客园 Ubuntu Server学习笔记 FCKeditor 上传自动重命名、按月创建文件夹和基本操作 [转] 软件测试计划模板 web测试的一些经验分享 软件测试流程实施方案 一些常用的正则表达式 - sig556 - 博客园 ASP.net国际化--页面可以选择输出语言 - sig556 - 博客园 项目开发过程文档 SharpZipLib使用示例 PostSharp - Lightweight Aspect-Oriented System 需求管理工具DOORS介绍 [转] B/S 系统界面设计规范
WCF X.509证书验证
sig556 · 2011-05-24 · via 博客园 - sig556

创建证书:

makecert.exe -sr CurrentUser -ss My -a sha1 -n CN=WCfServer -sky exchange -pe

1.服务器端:

system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="MtomBindingConfiguration"  messageEncoding="Mtom" maxReceivedMessageSize="1073741824" receiveTimeout="00:10:00">
                    <!--<security  mode="Transport">-->
                    <!--<transport clientCredentialType="Certificate"></transport>-->
                    <security >
                        <message clientCredentialType="Certificate"/>
                    </security>
                    <readerQuotas maxArrayLength="1073741824" />
                </binding>
            </wsHttpBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
            <service behaviorConfiguration="Service.WebServiceBehavior" name="Service.WebService">
                <endpoint address="" binding="wsHttpBinding" contract="IService.IWebService" bindingConfiguration="MtomBindingConfiguration" >
                    <!--<endpoint address="http://localhost:2397/WebService.svc" binding="wsHttpBinding" contract="IService.IWebService" bindingConfiguration="MtomBindingConfiguration" >-->
                </endpoint>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="Service.WebServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"  />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <serviceCredentials>
                        <clientCertificate>
                            <authentication certificateValidationMode="PeerTrust"/>
                            <!--<authentication  customCertificateValidatorType="WebServiceHost.X509Validation,WebServiceHost" certificateValidationMode="Custom"/>-->
                        </clientCertificate>
                        <serviceCertificate findValue="dlrfidWebServiceServer" storeName="My" storeLocation="CurrentUser" x509FindType="FindBySubjectName"/>
                    </serviceCredentials>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>

客户端:

 <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IWebService" closeTimeout="00:01:00"
                 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                 bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                 maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom"
                 textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                     maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                     enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                         realm="" />
                        <message clientCredentialType="Certificate" negotiateServiceCredential="true"
                         algorithmSuite="Default" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:2397/WebService.svc" binding="wsHttpBinding"
             bindingConfiguration="WSHttpBinding_IWebService" contract="WebService.IWebService"
             name="WSHttpBinding_IWebService" behaviorConfiguration="CustomBehavior">
                <identity>
                    <certificate encodedValue="AwAAAAEAAAAUAAAAeYh82ab7DzX7VgeBGszEb+mJREMgAAAAAQAAABkCAAAwggIVMIIBgqADAgECAhBQMedwa/rKvkXo0TVGSWNgMAkGBSsOAwIdBQAwITEfMB0GA1UEAxMWZGxyZmlkV2ViU2VydmljZVNlcnZlcjAeFw0xMTA1MjAwODM2MzRaFw0zOTEyMzEyMzU5NTlaMCExHzAdBgNVBAMTFmRscmZpZFdlYlNlcnZpY2VTZXJ2ZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMB5FBsK9MI5dmWviNY630BsR/9v6U1jZYPAkeZvHur/ylA/xX9Gk61R+Lf4w/tZKO6L71uKkHP8fouyO9xaZSTvB3IMc8g8+sg241gTbc+2V284TrpLukaUHUEHnDnWwyXE8iQjXwtM6Do3aaJl5tXOENwuSeJITMMM0a/Oa1RHAgMBAAGjVjBUMFIGA1UdAQRLMEmAEHIh43krSAoBbjxTloPkPyChIzAhMR8wHQYDVQQDExZkbHJmaWRXZWJTZXJ2aWNlU2VydmVyghBQMedwa/rKvkXo0TVGSWNgMAkGBSsOAwIdBQADgYEAGHb2SjF3/loPJTuQtWMEP8fLrrEcWoqi7dkzqDUvTXtW0lFIH5xgG8EQublAJYGZBFUcXCmm/wLOd4Bhj9IvlbuvB08zVzf4amO8YWJyeKImJ0yJKwaH2lwL3JsXV5saQC2JqAhQfPS/7Z6sd3D3ECySgVYOE2fkDBDd52QXX0Y=" />
                </identity>
            </endpoint>
        </client>
        <behaviors>
            <endpointBehaviors>
                <behavior name="CustomBehavior">
                    <clientCredentials>
                        <clientCertificate findValue="dlrfidWebServiceServer" storeName="My" storeLocation="CurrentUser" x509FindType="FindBySubjectName" />
                        <serviceCertificate>
                            <authentication certificateValidationMode="PeerTrust"/>
                        </serviceCertificate>
                    </clientCredentials>
                </behavior>
            </endpointBehaviors>
        </behaviors>

    </system.serviceModel>

 makecert -sr LocalMachine -ss My -a sha1 -n CN=Webabcd -sky exchange -pe
certmgr -add -r LocalMachine -s My -c -n Webabcd -s TrustedPeople