示例#1
0
        public void Sign(SignOption options)
        {
            string signTool = Path.Combine(options.SignToolPath, "signtool.exe");

            ProcessStartInfo startInfo = new ProcessStartInfo(signTool, $"sign /a /tr {options.TimeServerLocation} /td SHA256 {options.ApplicationFile}");

            startInfo.UseShellExecute        = false;
            startInfo.RedirectStandardOutput = true;

            var process = Process.Start(startInfo);
            // process.WaitForExit();
            var element = GetTokenPasswordTextBox();

            if (SetPassword(element, options.CertificatePassword))
            {
                Console.WriteLine("File signed successfully");
            }
        }
示例#2
0
        private static void OnVerbCommand(string verbArgument, object verbOptions)
        {
            SignOption options = verbOptions as SignOption;

            if (options != null)//parsing successful
            {
                Console.Write(verbArgument);
                if (verbArgument.ToLower().Equals(SignOption.Verb))
                {
                    //logic to sign the app
                    SignAutomation automation = new SignAutomation();
                    automation.Sign(options);
                }
                else
                {
                    WriteUsagesAndThrowError(new HelperOptions());
                }
            }
            else
            {
                Console.WriteLine($"Verbargument {verbArgument} and options are {verbOptions}");
                WriteUsagesAndThrowError(new HelperOptions());
            }
        }