Skip to content

Instantly share code, notes, and snippets.

@arman-hpp
Created March 21, 2022 08:26
Show Gist options
  • Save arman-hpp/13b2a7c8c517f40676fad5e88f6cd749 to your computer and use it in GitHub Desktop.
Save arman-hpp/13b2a7c8c517f40676fad5e88f6cd749 to your computer and use it in GitHub Desktop.
CertInstaller.cs
using System;
using System.Security.Cryptography.X509Certificates;
namespace CertInstaller
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(@"Certificate Installer v1.0");
var certificate = new X509Certificate2(Certificates.QTasCert, "12345");
var rootStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
rootStore.Open(OpenFlags.ReadWrite);
rootStore.Add(certificate);
rootStore.Close();
var myStore = new X509Store(StoreName.My, StoreLocation.LocalMachine);
myStore.Open(OpenFlags.ReadWrite);
myStore.Add(certificate);
myStore.Close();
Console.WriteLine(@"Certificate Installed Successfuly");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment