Exemplo n.º 1
0
 public GXDeviceCipheringSettings(string address, string title, string keysPath, string certificatesPath)
 {
     InitializeComponent();
     _address          = address;
     _title            = title;
     _keysPath         = keysPath;
     _certificatesPath = certificatesPath;
     _privateKeys      = new GXPkcs8Collection();
     _certifications   = new GXx509CertificateCollection();
     _privateKeys.Import(keysPath);
     _certifications.Import(certificatesPath);
     SigningCb.Items.AddRange(new object[] { Signing.None, Signing.OnePassDiffieHellman, Signing.StaticUnifiedModel, Signing.GeneralSigning });
     SecuritySuiteCb.Items.AddRange(new object[] { SecuritySuite.Suite0, SecuritySuite.Suite1, SecuritySuite.Suite2 });
     SecurityCB.Items.AddRange(new object[] { Security.None, Security.Authentication,
                                              Security.Encryption, Security.AuthenticationEncryption });
     SecurityCB.SelectedIndex      = 0;
     SecuritySuiteCb.SelectedIndex = 0;
     ShowKeys();
     _checkSystemTitle = true;
     updateUI          = true;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Generate private key and certificate for the client.
 /// </summary>
 private void PrivatekeyBtn_Click(object sender, EventArgs e)
 {
     try
     {
         GXEcdsaKeysDlg dlg = new GXEcdsaKeysDlg(_address, _keysPath,
                                                 _certificatesPath,
                                                 _title,
                                                 SecuritySuite,
                                                 GXDLMSTranslator.HexToBytes(SystemTitle));
         if (dlg.ShowDialog(Parent) == DialogResult.OK)
         {
             _privateKeys.Import(_keysPath);
             _certifications.Import(_certificatesPath);
             ShowKeys();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Parent, ex.Message);
     }
 }