Example #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            FrmCertPass CertPassDialog = new FrmCertPass();

            if (CertPassDialog.ShowDialog(this) == DialogResult.OK)
            {
                Settings.CertificatePassword = CertPassDialog.CertPass.Text;
            }
            CertPassDialog.Dispose();
            SetCertificate(CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 4096));
        }
Example #2
0
        private void InitializeServer()
        {
            X509Certificate2 serverCertificate;

#if DEBUG
            serverCertificate = CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 2048);
#else
            if (!File.Exists(Settings.CertificatePath))
            {
                using (var certificateSelection = new FrmCertificate())
                {
                    while (certificateSelection.ShowDialog() != DialogResult.OK)
                    {
                    }
                }
            }
            serverCertificate = new X509Certificate2(Settings.CertificatePath, Settings.CertificatePassword);
#endif
            ListenServer                     = new QuasarServer(serverCertificate);
            ListenServer.ServerState        += ServerState;
            ListenServer.ClientConnected    += ClientConnected;
            ListenServer.ClientDisconnected += ClientDisconnected;
        }
Example #3
0
        private void InitializeServer()
        {
            X509Certificate2 serverCertificate;

#if DEBUG
            serverCertificate = CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 2048);
#else
            if (!File.Exists(Settings.CertificatePath))
            {
                using (var certificateSelection = new FrmCertificate())
                {
                    while (certificateSelection.ShowDialog() != DialogResult.OK)
                    {
                    }
                }
            }
            serverCertificate = new X509Certificate2(Settings.CertificatePath);
#endif

            /*var str = Convert.ToBase64String(serverCertificate.Export(X509ContentType.Cert));
             *
             * var cert2 = new X509Certificate2(Convert.FromBase64String(str));
             * var serverCsp = (RSACryptoServiceProvider)serverCertificate.PublicKey.Key;
             * var connectedCsp = (RSACryptoServiceProvider)new X509Certificate2(cert2).PublicKey.Key;
             *
             * var result = serverCsp.ExportParameters(false);
             * var result2 = connectedCsp.ExportParameters(false);
             *
             * var b = SafeComparison.AreEqual(result.Exponent, result2.Exponent) &&
             *      SafeComparison.AreEqual(result.Modulus, result2.Modulus);*/

            ListenServer                     = new QuasarServer(serverCertificate);
            ListenServer.ServerState        += ServerState;
            ListenServer.ClientConnected    += ClientConnected;
            ListenServer.ClientDisconnected += ClientDisconnected;
        }
Example #4
0
        private void InitializeServer()
        {
            X509Certificate2 serverCertificate;

#if DEBUG
            serverCertificate = CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 2048);
#else
            string certificatePath = Path.Combine(Application.StartupPath, "quasar.p12");
            if (!File.Exists(certificatePath))
            {
                using (var certificateSelection = new FrmCertificate())
                {
                    while (certificateSelection.ShowDialog() != DialogResult.OK)
                    {
                    }
                }
            }
            serverCertificate = new X509Certificate2(certificatePath);
#endif
            ListenServer                     = new QuasarServer(serverCertificate);
            ListenServer.ServerState        += ServerState;
            ListenServer.ClientConnected    += ClientConnected;
            ListenServer.ClientDisconnected += ClientDisconnected;
        }
Example #5
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     _certificate    = CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 4096);
     txtDetails.Text = _certificate.ToString(false);
 }
Example #6
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     SetCertificate(CertificateHelper.CreateCertificateAuthority("Quasar Server CA", 4096));
 }