Coder Social home page Coder Social logo

dorssel / dotnet-aes-extra Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 236 KB

.NET Standard 2.0 implementation of AES-CTR, AES-CMAC, and SIV-AES (aka AES-SIV).

License: MIT License

C# 100.00%
aes aes-ctr aes-ctr-mode cryptography dotnet dotnet-standard aes-cmac aes-cmac-siv aes-siv cmac

dotnet-aes-extra's Introduction

dotnet-aes-extra

Build CodeQL MegaLinter codecov REUSE status NuGet

.NET Standard 2.0 implementation of the following AES modes that are not included in .NET 6.0 / .NET Framework:

  • AES-CTR, as defined by NIST SP 800-38A
  • AES-CMAC, as defined by NIST SP 800-38B
  • SIV-AES, as defined by RFC 5297
    (Note: this is often refered to as AES-SIV, but the original RFC specification uses the name SIV-AES)

The implementation is for AnyCPU, and works on all platforms.

Usage

The released binary NuGet packages and the .NET assemblies contained therein:

All public classes are in the Dorssel.Security.Cryptography namespace.

  • AesCtr is modeled after .NET's Aes. So, instead of Aes.Create(), use AesCtr.Create().
  • AesCmac is modeled after .NET's HMACSHA256. So, instead of new HMACSHA256(key), use new AesCmac(key).
  • AesSiv is modeled after .NET's AesGcm. So, instead of new AesGcm(key), use new AesSiv(key).

dotnet-aes-extra's People

Contributors

dependabot[bot] avatar dorssel avatar github-actions[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

rayokota

dotnet-aes-extra's Issues

AES-SIV tag comparison should be constant time

Hi @dorssel,

That's a nice looking library!

I believe the AES-SIV tag comparison:

if (!Enumerable.SequenceEqual(T, V))

should be changed to a method that is guaranteed to be constant time.
Otherwise, an attacker may be able to easily forge a valid tag.

If this is difficult in .NET, it may be enough to simply do a second comparison to a tag calculated with a random (freshly generated every time) key.

Also, it appears there is a debug message left in, here:

Console.WriteLine("Bingo");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.