static void Main(string[] args) { /// Define the expected certificate for signing ("<username>_sign" is the expected subject name). ///.NET WindowsIdentity class provides information about Windows user running the given process /// Define subjectName for certificate used for signing which is not as expected by the service var tuple = HelperFunctions.PrepBindingAndAddressForWriter(Config.ServiceCertificateCN); using (WriterProxy proxy = new WriterProxy(tuple.Item1, tuple.Item2)) { X509Certificate2 signCert = CertManager.GetCertificateFromStorage(StoreName.My, StoreLocation.LocalMachine, Config.WriterSign); int op = -1; while (op != 0) { op = DisplayWriterMenu(); ExecuteCommand(proxy, op, signCert); } } Console.ReadLine(); }
static void ExecuteCommand(WriterProxy proxy, int op, X509Certificate2 signCert) { HelperFunctions.ExecuteCommandWriter(proxy, op, signCert); }