Click here to Skip to main content
15,891,828 members
Articles / Programming Languages / Visual Basic

Encrypting a dataset using AES, including compression

Rate me:
Please Sign up or sign in to vote.
4.98/5 (49 votes)
21 Aug 2015CPOL7 min read 126.8K   4.8K   127  
Article describes how to encrypt a dataset using AES. Optionally the dataset is compressed before the encryption.
<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Encrypt dataset" 
        Height="350" 
        Width="525" 
        Closing="Window_Closing" 
        Icon="/EncryptDataSetVB;component/Images/Data.png" WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <GroupBox Grid.Row="0" Name="gbDataset" Header="Define dataset">
            <StackPanel Orientation="Horizontal" Margin="3">
                <CheckBox Name="chkCompress" Margin="3,3,15,3" Content="Use compressed file" VerticalAlignment="Center" />
                <Button Margin="3" Click="btnCreate_Click" Content="Create a new dataset..."/>
                <Button Margin="3" Click="btnOpen_Click" Content="Open dataset..."/>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Row="1" Name="gbData" Header="Current dataset: None" Padding="3">
            <DataGrid Name="dgContacts" AutoGenerateColumns="False" ItemsSource="{Binding}">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="First name" Binding="{Binding Path=FirstName}"  />
                    <DataGridTextColumn Header="Last name" Binding="{Binding Path=LastName}"  />
                    <DataGridTextColumn Header="Telephone" Binding="{Binding Path=Telephone}"  />
                    <DataGridTextColumn Header="E-mail" Binding="{Binding Path=Email}"  />
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <GroupBox Grid.Row="2" Name="gbActions" >
            <StackPanel Orientation="Horizontal" Margin="3" HorizontalAlignment="Right">
                <Button Margin="3" Name="btnSave" Click="btnSave_Click" Content="Save changes" IsEnabled="False" />
                <Button Margin="3" Name="btnCancel" Click="btnCancel_Click" Content="Cancel changes" IsEnabled="False" />
            </StackPanel>
        </GroupBox>
    </Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Europe Europe
Biography provided

Comments and Discussions