How to

download X.509 certificate from url

Published: 28. December 2014 | Updated: 28. December 2014
License: Microsoft Public License (MS-PL)
Categories: Security
Tags: C# Security
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at analyzant.com

Import namespaces

using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;

Code

var request = (HttpWebRequest)WebRequest.Create("https://www.verisign.com/");
var response = (HttpWebResponse)request.GetResponse();
response.Close();

X509Certificate cert = request.ServicePoint.Certificate;
var x509 = new X509Certificate2(cert);

Console.WriteLine(x509.Issuer);
Send us feedback about this snippet »



Related Snippets: