Security C#

using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
public class CryptoUtility
{
    public static string GetPublicKeyHash(HttpClientCertificate httpCertificate)
    {
        byte[] rawcert = httpCertificate.Certificate;
        X509Certificate x509Cert = new X509Certificate(rawcert);
        SHA256 sha = new SHA256Managed();
        byte[] hashvalue = sha.ComputeHash(x509Cert.GetPublicKey());
        return Convert.ToBase64String(hashvalue);
    }
}