Click here to Skip to main content
15,892,697 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 127K   4.8K   127  
Article describes how to encrypt a dataset using AES. Optionally the dataset is compressed before the encryption.
<Window x:Class="EncryptDataSet.UI.Authentication"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="clr-namespace:EncryptDataSet.UI"
        Title="Authentication" 
        Height="277" 
        Width="300" 
        Loaded="Window_Loaded" 
        Icon="/EncryptDataSet;component/Images/Authentication.png" 
        WindowStartupLocation="CenterOwner" 
        SizeToContent="WidthAndHeight"
        MinWidth="300">
    <Window.Resources>
        <ui:ForegroundConverter x:Key="ForegroundConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <TextBlock Margin="3" Text="Dataset file name"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBox Grid.Column="0" Margin="3" Name="txtFileName" IsReadOnly="True" IsTabStop="False" />
                <Button Grid.Column="1" Margin="3" Width="25" Name="btnFile" Click="btnFile_Click" Content="..."/>
            </Grid>
            <TextBlock Margin="3" Text="User name"/>
            <TextBox Margin="3" Name="txtUser"/>
            <TextBlock Margin="3" Text="Password"/>
            <PasswordBox Margin="3" Name="txtPassword" PasswordChanged="txtPassword_PasswordChanged" />
            <TextBlock Margin="3" Name="txtPasswordStrength"  Text="Password strength"/>
            <ProgressBar Margin="3" Name="pbPasswordStrength" Height="20" IsTabStop="False" Value="0" Foreground="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value, Converter={StaticResource ForegroundConverter}}"/>
        </StackPanel>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Margin="3" Width="70" Name="btnOk" Click="btnOk_Click" Content="Ok" IsDefault="True"/>
            <Button Margin="3" Width="70" Name="btnCancel" Click="btnCancel_Click" Content="Cancel" IsCancel="True"/>
        </StackPanel>
    </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