refactor(securestore): remove password-based authentication in favor of key-file only
Simplify SecureStore by removing MasterKeyEnvVar and password-based methods, leaving only key-file authentication for better security practices.
This commit is contained in:
@@ -61,10 +61,7 @@ public partial class MainWindow : Window
|
||||
if (result == true)
|
||||
{
|
||||
var vm = dialog.ViewModel;
|
||||
await ViewModel.CreateNewStoreAsync(
|
||||
vm.StorePath,
|
||||
vm.UseKeyFile ? vm.KeyFilePath : null,
|
||||
vm.UsePassword ? vm.Password : null);
|
||||
await ViewModel.CreateNewStoreAsync(vm.StorePath, vm.KeyFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +74,7 @@ public partial class MainWindow : Window
|
||||
if (result == true)
|
||||
{
|
||||
var vm = dialog.ViewModel;
|
||||
await ViewModel.OpenExistingStoreAsync(
|
||||
vm.StorePath,
|
||||
vm.UseKeyFile ? vm.KeyFilePath : null,
|
||||
vm.UsePassword ? vm.Password : null);
|
||||
await ViewModel.OpenExistingStoreAsync(vm.StorePath, vm.KeyFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
xmlns:vm="clr-namespace:JdeScoping.SecureStoreManager.ViewModels"
|
||||
x:Class="JdeScoping.SecureStoreManager.Views.NewStoreDialog"
|
||||
Title="Create New Store"
|
||||
Height="400" Width="500"
|
||||
Height="280" Width="500"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
CanResize="False"
|
||||
ShowInTaskbar="False">
|
||||
<!-- DataContext is set in code-behind -->
|
||||
|
||||
<Grid Margin="15" RowDefinitions="Auto,Auto,Auto,*,Auto">
|
||||
<Grid Margin="15" RowDefinitions="Auto,Auto,*,Auto">
|
||||
<!-- Store Path -->
|
||||
<Border Grid.Row="0" BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
@@ -26,25 +26,13 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Encryption Method -->
|
||||
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Encryption Method" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<RadioButton Content="Use Key File (recommended for production)"
|
||||
IsChecked="{Binding UseKeyFile, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
<RadioButton Content="Use Password"
|
||||
IsChecked="{Binding UsePassword, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Key File Settings -->
|
||||
<Border Grid.Row="2"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10"
|
||||
IsVisible="{Binding UseKeyFile}">
|
||||
<Border Grid.Row="1"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Key File" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<TextBlock Text="The key file is required to encrypt and decrypt the store."
|
||||
FontSize="11" Foreground="Gray" Margin="0,0,0,10" TextWrapping="Wrap" />
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBox Grid.Column="0"
|
||||
Text="{Binding KeyFilePath, Mode=TwoWay}"
|
||||
@@ -57,31 +45,8 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Password Settings -->
|
||||
<Border Grid.Row="2"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10"
|
||||
IsVisible="{Binding UsePassword}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Password" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<Grid ColumnDefinitions="100,*" RowDefinitions="Auto,Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Password:" VerticalAlignment="Center" Margin="0,5" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
x:Name="PasswordBox"
|
||||
PasswordChar="*"
|
||||
Text="{Binding Password, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Confirm:" VerticalAlignment="Center" Margin="0,5" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
x:Name="ConfirmPasswordBox"
|
||||
PasswordChar="*"
|
||||
Text="{Binding ConfirmPassword, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Validation Error -->
|
||||
<TextBlock Grid.Row="3"
|
||||
<TextBlock Grid.Row="2"
|
||||
Text="{Binding ValidationError}"
|
||||
Foreground="Red"
|
||||
FontSize="11"
|
||||
@@ -90,7 +55,7 @@
|
||||
VerticalAlignment="Top" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<Button Content="Create" Click="CreateButton_Click" IsEnabled="{Binding IsValid}" MinWidth="80" Padding="10,5" />
|
||||
<Button Content="Cancel" Click="CancelButton_Click" MinWidth="80" Padding="10,5" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
xmlns:vm="clr-namespace:JdeScoping.SecureStoreManager.ViewModels"
|
||||
x:Class="JdeScoping.SecureStoreManager.Views.OpenStoreDialog"
|
||||
Title="Open Store"
|
||||
Height="370" Width="500"
|
||||
Height="280" Width="500"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
CanResize="False"
|
||||
ShowInTaskbar="False">
|
||||
<!-- DataContext is set in code-behind -->
|
||||
|
||||
<Grid Margin="15" RowDefinitions="Auto,Auto,Auto,*,Auto">
|
||||
<Grid Margin="15" RowDefinitions="Auto,Auto,*,Auto">
|
||||
<!-- Store Path -->
|
||||
<Border Grid.Row="0" BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
@@ -26,25 +26,13 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Decryption Method -->
|
||||
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Decryption Method" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<RadioButton Content="Use Key File"
|
||||
IsChecked="{Binding UseKeyFile, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
<RadioButton Content="Use Password"
|
||||
IsChecked="{Binding UsePassword, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Key File Settings -->
|
||||
<Border Grid.Row="2"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10"
|
||||
IsVisible="{Binding UseKeyFile}">
|
||||
<Border Grid.Row="1"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Key File" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<TextBlock Text="Select the key file used to encrypt this store."
|
||||
FontSize="11" Foreground="Gray" Margin="0,0,0,10" TextWrapping="Wrap" />
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBox Grid.Column="0"
|
||||
Text="{Binding KeyFilePath, Mode=TwoWay}"
|
||||
@@ -57,25 +45,8 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Password Settings -->
|
||||
<Border Grid.Row="2"
|
||||
BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="10" Margin="0,0,0,10"
|
||||
IsVisible="{Binding UsePassword}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Password" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
<Grid ColumnDefinitions="100,*">
|
||||
<TextBlock Text="Password:" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1"
|
||||
x:Name="PasswordBox"
|
||||
PasswordChar="*"
|
||||
Text="{Binding Password, Mode=TwoWay}"
|
||||
Margin="0,5" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Validation Error -->
|
||||
<TextBlock Grid.Row="3"
|
||||
<TextBlock Grid.Row="2"
|
||||
Text="{Binding ValidationError}"
|
||||
Foreground="Red"
|
||||
FontSize="11"
|
||||
@@ -84,7 +55,7 @@
|
||||
VerticalAlignment="Top" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<Button Content="Open" Click="OpenButton_Click" IsEnabled="{Binding IsValid}" MinWidth="80" Padding="10,5" />
|
||||
<Button Content="Cancel" Click="CancelButton_Click" MinWidth="80" Padding="10,5" />
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user