Skip to content

AesCryptFromStreamExample is an assembly/ library to serialize and encrypt data structures from C# as XML string to a file using AESCrypt.

License

Notifications You must be signed in to change notification settings

SeppPenner/AesCryptFromStreamExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AesCryptFromStreamExample

AesCryptFromStreamExample is an assembly/ library to serialize and encrypt data structures from C# as XML string to a file using AESCrypt.

Build status GitHub issues GitHub forks GitHub stars License: MIT Known Vulnerabilities Blogger Patreon PayPal

Basic usage

private void Test()
{
    var dbConnections = new List<DbConnection>
    {
        new DbConnection
        {
            ConnectionString = "cloud.asdf.org:user:password",
            Name = "ASDF cloud"
        },
        new DbConnection
        {
            ConnectionString = "cloud.asdf2.org:user:password",
            Name = "ASDF cloud2"
        }
    };
    using (var aesCryptor = new AesCryptor())
    {
        aesCryptor.EncryptDbConnectionsToFile("Test.txt", dbConnections, "TestPW");
        //File Test.txt.aes created with the encrypted data types
        var dbConnectionsLoaded = aesCryptor.DecryptFileToDbConnection("Test.txt", "TestPW");
        //dbConnectionsLoaded contains the stored data types in the file
    }
}

Additional information

This example only works with the AESCrypt library from NuGet.

You can easily customize the services when changing the DbConnection class, the XmlRootAttribute("DbConnections") in the AESCryptor class and the DbConnections class (Especially the [XmlRoot("DbConnections")]) to anything else (Maybe even a generic way with T parameter is possible).

Change history

See the Changelog.

About

AesCryptFromStreamExample is an assembly/ library to serialize and encrypt data structures from C# as XML string to a file using AESCrypt.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages