Thursday, October 11, 2018

Add a certificate to your laptop with C#!

public void SaveCert(byte[] bytes, string name)
{
   X509Certificate2 x509Certificate2 = new X509Certificate2(bytes);
   x509Certificate2.FriendlyName = name;
   X509Store x509Store = new X509Store(StoreName.TrustedPublisher,
         StoreLocation.LocalMachine);
   x509Store.Open(OpenFlags.ReadWrite);
   x509Store.Add(x509Certificate2);
   x509Store.Close();
}

No comments:

Post a Comment