UI: Master-Key-Button (Settings, via Designer) + UI-Designer-WIP + Steuer-PDF

- Settings: neuer Toolbar-Button 'Master-Key erzeugen' (Tab General Settings, via Designer).
  Erzeugt zufaelligen 32-Byte-AES-Key -> master.key (gitignored), nur aktiv wenn KEIN Key
  existiert (Env-Var oder Datei), Lockout-Schutz + Backup-Warnung, danach deaktiviert.
- Einbezogen: laufende Designer-Umstrukturierung (SettingsView/LauncherForm: Button-Bilder
  aus Properties.Resources statt eingebettet; dgv_accountlist im Launcher; DashboardView.resx).
- docs/steuer: US-CPA-Fragebogen als PDF.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-15 09:27:34 +02:00
co-authored by Claude Opus 4.8
parent 36c89a6acf
commit 4df07bd3d2
6 changed files with 427 additions and 147 deletions
+42 -5
View File
@@ -32,10 +32,14 @@ namespace PolyTraderSharp.Ui
lbl_trading = new ToolStripStatusLabel();
lbl_modules = new ToolStripStatusLabel();
lbl_ratelimit = new ToolStripStatusLabel();
dgv_accountlist = new DataGridView();
btn_accounting = new ToolStripButton();
toolStripSeparator1 = new ToolStripSeparator();
menuStrip.SuspendLayout();
toolstrip_windows.SuspendLayout();
toolstrip_quickbar.SuspendLayout();
statusStrip_info.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgv_accountlist).BeginInit();
SuspendLayout();
//
// menuStrip
@@ -54,18 +58,18 @@ namespace PolyTraderSharp.Ui
miDatei.Name = "miDatei";
miDatei.Size = new Size(69, 29);
miDatei.Text = "Datei";
//
//
// miBeenden
//
miBeenden.Name = "miBeenden";
miBeenden.Size = new Size(275, 34);
miBeenden.Size = new Size(182, 34);
miBeenden.Text = "Beenden";
//
// toolstrip_windows
//
toolstrip_windows.AutoSize = false;
toolstrip_windows.ImageScalingSize = new Size(64, 64);
toolstrip_windows.Items.AddRange(new ToolStripItem[] { btn_dashboard, btn_settings, btn_terminal, btn_jobs });
toolstrip_windows.Items.AddRange(new ToolStripItem[] { btn_dashboard, btn_settings, btn_terminal, btn_jobs, btn_accounting, toolStripSeparator1 });
toolstrip_windows.Location = new Point(0, 35);
toolstrip_windows.Name = "toolstrip_windows";
toolstrip_windows.Size = new Size(2599, 70);
@@ -140,7 +144,7 @@ namespace PolyTraderSharp.Ui
statusStrip_info.BackColor = Color.Gainsboro;
statusStrip_info.ImageScalingSize = new Size(24, 24);
statusStrip_info.Items.AddRange(new ToolStripItem[] { lbl_trading, lbl_modules, lbl_ratelimit });
statusStrip_info.Location = new Point(0, 140);
statusStrip_info.Location = new Point(0, 637);
statusStrip_info.Name = "statusStrip_info";
statusStrip_info.Size = new Size(2599, 32);
statusStrip_info.TabIndex = 5;
@@ -164,11 +168,40 @@ namespace PolyTraderSharp.Ui
lbl_ratelimit.Size = new Size(66, 25);
lbl_ratelimit.Text = "API: —";
//
// dgv_accountlist
//
dgv_accountlist.AllowUserToAddRows = false;
dgv_accountlist.AllowUserToDeleteRows = false;
dgv_accountlist.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgv_accountlist.Dock = DockStyle.Fill;
dgv_accountlist.Location = new Point(0, 139);
dgv_accountlist.Name = "dgv_accountlist";
dgv_accountlist.ReadOnly = true;
dgv_accountlist.RowHeadersWidth = 62;
dgv_accountlist.Size = new Size(2599, 498);
dgv_accountlist.TabIndex = 6;
//
// btn_accounting
//
btn_accounting.Image = Properties.Resources.coins_in_hand;
btn_accounting.ImageScaling = ToolStripItemImageScaling.None;
btn_accounting.ImageTransparentColor = Color.Magenta;
btn_accounting.Name = "btn_accounting";
btn_accounting.Size = new Size(106, 65);
btn_accounting.Text = "Accounting";
btn_accounting.TextImageRelation = TextImageRelation.ImageAboveText;
//
// toolStripSeparator1
//
toolStripSeparator1.Name = "toolStripSeparator1";
toolStripSeparator1.Size = new Size(6, 70);
//
// LauncherForm
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(2599, 172);
ClientSize = new Size(2599, 669);
Controls.Add(dgv_accountlist);
Controls.Add(statusStrip_info);
Controls.Add(toolstrip_quickbar);
Controls.Add(toolstrip_windows);
@@ -187,6 +220,7 @@ namespace PolyTraderSharp.Ui
toolstrip_quickbar.PerformLayout();
statusStrip_info.ResumeLayout(false);
statusStrip_info.PerformLayout();
((System.ComponentModel.ISupportInitialize)dgv_accountlist).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -208,5 +242,8 @@ namespace PolyTraderSharp.Ui
private ToolStripStatusLabel lbl_trading;
private ToolStripStatusLabel lbl_modules;
private ToolStripStatusLabel lbl_ratelimit;
private ToolStripButton btn_accounting;
private ToolStripSeparator toolStripSeparator1;
private DataGridView dgv_accountlist;
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+89 -117
View File
@@ -17,52 +17,48 @@ namespace PolyTraderSharp.Ui.Views
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsView));
propertyGrid = new PropertyGrid();
toolStrip1 = new ToolStrip();
tabControl1 = new TabControl();
tabPage1 = new TabPage();
tabPage2 = new TabPage();
toolStrip2 = new ToolStrip();
btn_save = new ToolStripButton();
btn_loadsettings = new ToolStripButton();
btnGenMasterKey = new ToolStripButton();
tabPage2 = new TabPage();
pgAccount = new PropertyGrid();
dgvAccounts = new DataGridView();
toolStripAccounts = new ToolStrip();
btnAccNew = new ToolStripButton();
btnAccDelete = new ToolStripButton();
dgvAccounts = new DataGridView();
colAccName = new DataGridViewTextBoxColumn();
colAccWallet = new DataGridViewTextBoxColumn();
colAccDemo = new DataGridViewCheckBoxColumn();
colAccActive = new DataGridViewCheckBoxColumn();
pgAccount = new PropertyGrid();
tabControl1.SuspendLayout();
tabPage1.SuspendLayout();
tabPage2.SuspendLayout();
toolStrip2.SuspendLayout();
toolStripAccounts.SuspendLayout();
tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgvAccounts).BeginInit();
toolStripAccounts.SuspendLayout();
SuspendLayout();
//
//
// propertyGrid
//
//
propertyGrid.Dock = DockStyle.Bottom;
propertyGrid.Location = new Point(3, 610);
propertyGrid.Margin = new Padding(4, 25, 4, 5);
propertyGrid.Name = "propertyGrid";
propertyGrid.Size = new Size(1171, 274);
propertyGrid.TabIndex = 1;
//
//
// toolStrip1
//
//
toolStrip1.ImageScalingSize = new Size(24, 24);
toolStrip1.Location = new Point(0, 0);
toolStrip1.Name = "toolStrip1";
toolStrip1.Size = new Size(1185, 25);
toolStrip1.TabIndex = 2;
toolStrip1.Text = "toolStrip1";
//
//
// tabControl1
//
//
tabControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
tabControl1.Controls.Add(tabPage1);
tabControl1.Controls.Add(tabPage2);
@@ -71,9 +67,9 @@ namespace PolyTraderSharp.Ui.Views
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(1185, 925);
tabControl1.TabIndex = 3;
//
//
// tabPage1
//
//
tabPage1.Controls.Add(toolStrip2);
tabPage1.Controls.Add(propertyGrid);
tabPage1.Location = new Point(4, 34);
@@ -83,9 +79,43 @@ namespace PolyTraderSharp.Ui.Views
tabPage1.TabIndex = 0;
tabPage1.Text = "General Settings";
tabPage1.UseVisualStyleBackColor = true;
//
// toolStrip2
//
toolStrip2.ImageScalingSize = new Size(24, 24);
toolStrip2.Items.AddRange(new ToolStripItem[] { btn_save, btn_loadsettings, btnGenMasterKey });
toolStrip2.Location = new Point(3, 3);
toolStrip2.Name = "toolStrip2";
toolStrip2.Size = new Size(1171, 34);
toolStrip2.TabIndex = 0;
toolStrip2.Text = "toolStrip2";
//
// btn_save
//
btn_save.Image = Properties.Resources.diskette;
btn_save.ImageTransparentColor = Color.Magenta;
btn_save.Name = "btn_save";
btn_save.Size = new Size(150, 29);
btn_save.Text = "Save Changes";
//
// btn_loadsettings
//
btn_loadsettings.Image = Properties.Resources.token_quantifier;
btn_loadsettings.ImageTransparentColor = Color.Magenta;
btn_loadsettings.Name = "btn_loadsettings";
btn_loadsettings.Size = new Size(223, 29);
btn_loadsettings.Text = "Load Settings from File";
//
// btnGenMasterKey
//
btnGenMasterKey.DisplayStyle = ToolStripItemDisplayStyle.Text;
btnGenMasterKey.Name = "btnGenMasterKey";
btnGenMasterKey.Size = new Size(200, 29);
btnGenMasterKey.Text = "Master-Key erzeugen";
btnGenMasterKey.ToolTipText = "Erzeugt einen zufälligen AES-Master-Key (nur wenn noch keiner existiert).";
//
// tabPage2
//
//
tabPage2.Controls.Add(pgAccount);
tabPage2.Controls.Add(dgvAccounts);
tabPage2.Controls.Add(toolStripAccounts);
@@ -96,115 +126,56 @@ namespace PolyTraderSharp.Ui.Views
tabPage2.TabIndex = 1;
tabPage2.Text = "Polymarket Accounts";
tabPage2.UseVisualStyleBackColor = true;
//
// toolStrip2
//
toolStrip2.ImageScalingSize = new Size(24, 24);
toolStrip2.Items.AddRange(new ToolStripItem[] { btn_save, btn_loadsettings });
toolStrip2.Location = new Point(3, 3);
toolStrip2.Name = "toolStrip2";
toolStrip2.Size = new Size(1171, 34);
toolStrip2.TabIndex = 0;
toolStrip2.Text = "toolStrip2";
//
// btn_save
//
btn_save.Image = (Image)resources.GetObject("btn_save.Image");
btn_save.ImageTransparentColor = Color.Magenta;
btn_save.Name = "btn_save";
btn_save.Size = new Size(150, 29);
btn_save.Text = "Save Changes";
//
// btn_loadsettings
//
btn_loadsettings.Image = (Image)resources.GetObject("btn_loadsettings.Image");
btn_loadsettings.ImageTransparentColor = Color.Magenta;
btn_loadsettings.Name = "btn_loadsettings";
btn_loadsettings.Size = new Size(223, 29);
btn_loadsettings.Text = "Load Settings from File";
//
// toolStripAccounts
//
toolStripAccounts.ImageScalingSize = new Size(24, 24);
toolStripAccounts.Items.AddRange(new ToolStripItem[] { btnAccNew, btnAccDelete });
toolStripAccounts.Location = new Point(3, 3);
toolStripAccounts.Name = "toolStripAccounts";
toolStripAccounts.Size = new Size(1171, 34);
toolStripAccounts.TabIndex = 0;
//
// btnAccNew
//
btnAccNew.DisplayStyle = ToolStripItemDisplayStyle.Text;
btnAccNew.Name = "btnAccNew";
btnAccNew.Size = new Size(130, 29);
btnAccNew.Text = "Neuer Account";
//
// btnAccDelete
//
btnAccDelete.DisplayStyle = ToolStripItemDisplayStyle.Text;
btnAccDelete.Name = "btnAccDelete";
btnAccDelete.Size = new Size(90, 29);
btnAccDelete.Text = "Löschen";
//
//
// pgAccount
//
pgAccount.Dock = DockStyle.Fill;
pgAccount.Location = new Point(623, 37);
pgAccount.Name = "pgAccount";
pgAccount.Size = new Size(551, 847);
pgAccount.TabIndex = 2;
//
// dgvAccounts
//
//
dgvAccounts.AllowUserToAddRows = false;
dgvAccounts.AllowUserToDeleteRows = false;
dgvAccounts.AutoGenerateColumns = false;
dgvAccounts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvAccounts.Columns.AddRange(new DataGridViewColumn[] { colAccName, colAccWallet, colAccDemo, colAccActive });
dgvAccounts.Dock = DockStyle.Left;
dgvAccounts.Location = new Point(3, 37);
dgvAccounts.MultiSelect = false;
dgvAccounts.Name = "dgvAccounts";
dgvAccounts.ReadOnly = true;
dgvAccounts.RowHeadersVisible = false;
dgvAccounts.RowHeadersWidth = 62;
dgvAccounts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvAccounts.Size = new Size(620, 847);
dgvAccounts.TabIndex = 1;
//
// colAccName
//
colAccName.DataPropertyName = "Name";
colAccName.HeaderText = "Name";
colAccName.Name = "colAccName";
colAccName.ReadOnly = true;
colAccName.Width = 200;
//
// colAccWallet
//
colAccWallet.DataPropertyName = "WalletAddress";
colAccWallet.HeaderText = "Wallet";
colAccWallet.Name = "colAccWallet";
colAccWallet.ReadOnly = true;
colAccWallet.Width = 260;
//
// colAccDemo
//
colAccDemo.DataPropertyName = "IsDemo";
colAccDemo.HeaderText = "Demo";
colAccDemo.Name = "colAccDemo";
colAccDemo.ReadOnly = true;
colAccDemo.Width = 60;
//
// colAccActive
//
colAccActive.DataPropertyName = "IsActive";
colAccActive.HeaderText = "Aktiv";
colAccActive.Name = "colAccActive";
colAccActive.ReadOnly = true;
colAccActive.Width = 60;
//
// pgAccount
//
pgAccount.Dock = DockStyle.Fill;
pgAccount.Location = new Point(623, 37);
pgAccount.Name = "pgAccount";
pgAccount.Size = new Size(551, 847);
pgAccount.TabIndex = 2;
//
//
// toolStripAccounts
//
toolStripAccounts.ImageScalingSize = new Size(24, 24);
toolStripAccounts.Items.AddRange(new ToolStripItem[] { btnAccNew, btnAccDelete });
toolStripAccounts.Location = new Point(3, 3);
toolStripAccounts.Name = "toolStripAccounts";
toolStripAccounts.Size = new Size(1171, 34);
toolStripAccounts.TabIndex = 0;
//
// btnAccNew
//
btnAccNew.Image = Properties.Resources.add;
btnAccNew.Name = "btnAccNew";
btnAccNew.Size = new Size(157, 29);
btnAccNew.Text = "Neuer Account";
//
// btnAccDelete
//
btnAccDelete.Image = Properties.Resources.cancel;
btnAccDelete.Name = "btnAccDelete";
btnAccDelete.Size = new Size(104, 29);
btnAccDelete.Text = "Löschen";
//
// SettingsView
//
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1185, 1523);
@@ -216,13 +187,13 @@ namespace PolyTraderSharp.Ui.Views
tabControl1.ResumeLayout(false);
tabPage1.ResumeLayout(false);
tabPage1.PerformLayout();
tabPage2.ResumeLayout(false);
tabPage2.PerformLayout();
toolStrip2.ResumeLayout(false);
toolStrip2.PerformLayout();
tabPage2.ResumeLayout(false);
tabPage2.PerformLayout();
((System.ComponentModel.ISupportInitialize)dgvAccounts).EndInit();
toolStripAccounts.ResumeLayout(false);
toolStripAccounts.PerformLayout();
((System.ComponentModel.ISupportInitialize)dgvAccounts).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -237,6 +208,7 @@ namespace PolyTraderSharp.Ui.Views
private TabPage tabPage2;
private ToolStripButton btn_save;
private ToolStripButton btn_loadsettings;
private ToolStripButton btnGenMasterKey;
private ToolStrip toolStripAccounts;
private ToolStripButton btnAccNew;
private ToolStripButton btnAccDelete;
+53
View File
@@ -1,6 +1,8 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Windows.Forms;
using PolyTrader.Core.Persistence;
using PolyTraderSharp.Models;
@@ -33,6 +35,8 @@ namespace PolyTraderSharp.Ui.Views
btn_save.Click += (_, _) => Save();
btn_loadsettings.Click += (_, _) => Reload();
btnGenMasterKey.Click += (_, _) => GenerateMasterKey();
UpdateMasterKeyButtonState();
btnAccNew.Click += (_, _) => AddAccount();
btnAccDelete.Click += (_, _) => DeleteAccount();
@@ -129,5 +133,54 @@ namespace PolyTraderSharp.Ui.Views
_state?.Accounts.AddOrUpdate(acc.AccountId, acc, (_, _) => acc);
dgvAccounts.Refresh();
}
// ===== Master-Key (at-rest-Verschlüsselung, F1) =====
/// <summary>Pfad der Master-Key-Datei identisch zu Program.cs (App-Ordner, gitignored).</summary>
private static string MasterKeyFilePath => Path.Combine(AppContext.BaseDirectory, "master.key");
/// <summary>Existiert bereits ein Master-Key (Umgebungsvariable ODER Datei)?</summary>
private static bool MasterKeyExists() =>
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("POLYTRADER_MASTER_KEY"))
|| File.Exists(MasterKeyFilePath);
/// <summary>Button nur aktiv, solange KEIN Master-Key existiert (Überschreiben = Lockout-Gefahr).</summary>
private void UpdateMasterKeyButtonState() => btnGenMasterKey.Enabled = !MasterKeyExists();
private void GenerateMasterKey()
{
// Sicherheitsnetz gegen Race/Doppelklick: einen bestehenden Key NIEMALS überschreiben.
if (MasterKeyExists())
{
MessageBox.Show(
"Es existiert bereits ein Master-Key Erzeugung abgebrochen. Ein Überschreiben würde den " +
"Zugriff auf bereits verschlüsselte Wallet-Keys unwiederbringlich zerstören.",
"Master-Key vorhanden", MessageBoxButtons.OK, MessageBoxIcon.Warning);
UpdateMasterKeyButtonState();
return;
}
try
{
byte[] keyBytes = RandomNumberGenerator.GetBytes(32); // 256-Bit-Schlüssel
File.WriteAllText(MasterKeyFilePath, Convert.ToBase64String(keyBytes));
_logger?.Info("🔐 Master-Key erzeugt und in master.key gespeichert. At-rest-Verschlüsselung wird beim nächsten Start aktiv.");
MessageBox.Show(
"Ein zufälliger 32-Byte-Master-Key wurde erzeugt und in der Datei 'master.key' (App-Ordner, gitignored) gespeichert.\n\n" +
"WICHTIG:\n" +
"• Sichere diese Datei SOFORT separat und sicher (z. B. Passwort-Manager / Offline-Backup).\n" +
"• Master-Key-Verlust = KEIN Zugriff mehr auf die verschlüsselten Wallet-Keys!\n" +
"• Die Verschlüsselung der Account-Credentials wird beim nächsten Programmstart aktiv.",
"Master-Key erzeugt", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show($"Fehler beim Erzeugen des Master-Keys: {ex.Message}",
"Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
UpdateMasterKeyButtonState(); // nach Erzeugung deaktivieren
}
}
}
+5 -25
View File
@@ -118,32 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
<value>225, 17</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>162, 17</value>
<value>370, 17</value>
</metadata>
<metadata name="toolStripAccounts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btn_save.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAEBSURBVEhL3ZIvC8JAGIf3OTTZ/A62+RXs2g2rFsGi2P0C
WlwT02wGMQjLhgVRnAMR/5bVV37CHeduf9TdFQfPDt7wPOy9GWEYkk4MvGzbJsuylAInD2BgmqZS4JQC
99tDCcoCl+OBPKdH3qxHe3eiPuAOTFq0CxwWURYQ5QBfojfgKA5sl0Mux7pwJx8H/NOdmvPj64yKs8gM
QFqdBlQc7V/nt5HUwDq4cTnj20hiYLW7Unnsv8l/icQGKrVGojwrgpk4lwL1VpdKw40kjCMaYfclzqVA
3z1LojSYTPwZ2Bxrzh1gsujPALBmrDt3IA2sG2vXFgBw/lFAJwh0dGLofp4xWrfOyeSKuAAAAABJRU5E
rkJggg==
</value>
</data>
<data name="btn_loadsettings.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAEBSURBVEhL3ZIvC8JAGIf3OTTZ/A62+RXs2g2rFsGi2P0C
WlwT02wGMQjLhgVRnAMR/5bVV37CHeduf9TdFQfPDt7wPOy9GWEYkk4MvGzbJsuylAInD2BgmqZS4JQC
99tDCcoCl+OBPKdH3qxHe3eiPuAOTFq0CxwWURYQ5QBfojfgKA5sl0Mux7pwJx8H/NOdmvPj64yKs8gM
QFqdBlQc7V/nt5HUwDq4cTnj20hiYLW7Unnsv8l/icQGKrVGojwrgpk4lwL1VpdKw40kjCMaYfclzqVA
3z1LojSYTPwZ2Bxrzh1gsujPALBmrDt3IA2sG2vXFgBw/lFAJwh0dGLofp4xWrfOyeSKuAAAAABJRU5E
rkJggg==
</value>
</data>
</root>