HTTPS/Client-authenticated: Difference between revisions
Content added Content deleted
m (removed omit for REXX. -- ~~~~) |
(add C#) |
||
Line 5: | Line 5: | ||
This task is in general useful for use with [[Creating a SOAP Client|webservice client]]s as it offers a high level of assurance that the client is an acceptable counterparty for the server. For example, [http://aws.amazon.com/ Amazon Web Services] uses this style of authentication. |
This task is in general useful for use with [[Creating a SOAP Client|webservice client]]s as it offers a high level of assurance that the client is an acceptable counterparty for the server. For example, [http://aws.amazon.com/ Amazon Web Services] uses this style of authentication. |
||
=={{header|C sharp|C#}}== |
|||
{{works with|C sharp|3.0}} |
|||
<lang csharp> |
|||
using System; |
|||
using System.Net; |
|||
class Program |
|||
{ |
|||
class MyWebClient : WebClient |
|||
{ |
|||
protected override WebRequest GetWebRequest(Uri address) |
|||
{ |
|||
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address); |
|||
request.ClientCertificates.Add(new X509Certificate()); |
|||
return request; |
|||
} |
|||
} |
|||
static void Main(string[] args) |
|||
{ |
|||
var client = new MyWebClient(); |
|||
var data = client.DownloadString("https://example.com"); |
|||
Console.WriteLine(data); |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|Lasso}}== |
=={{header|Lasso}}== |
||
<lang Lasso>local(sslcert = file('myCert.pem')) |
<lang Lasso>local(sslcert = file('myCert.pem')) |