Giter VIP home page Giter VIP logo

alecgn / crypthash-net Goto Github PK

View Code? Open in Web Editor NEW
40.0 4.0 9.0 461 KB

CryptHash.NET is a .NET multi-target library to encrypt/decrypt/hash/encode/decode strings and files, with an optional .NET Core multiplatform console utility.

License: MIT License

C# 99.86% Batchfile 0.14%
encryption decryption cryptography security c-sharp csharp dotnet dotnet-core dotnet-standard hash hmac bcrypt argon2 password authentication encode decode aes cbc gcm

crypthash-net's Introduction

CryptHash.NET

*Warning*: this repo is being migrated to https://github.com/alecgn/CryptographyHelpers

Build and tests status (crypthash-net) Nuget version (CryptHash.Net) Nuget downloads (CryptHash.Net) Tests status (crypthash-net)

Backed with ❤️ by JetBrains software:

Rider ReSharper

A .NET multi-target Library and .NET Core Console Application utility for encryption/decryption, hashing and encoding/decoding.

The .NET Core console utility is designed to run in Windows, Linux and Mac, for text and files symmetric authenticated encryption/decryption, text/files hashing and text encoding/decoding. File checksum functionality is also available, you can calculate and verify the integrity of downloaded files from the internet with the source supplied hash.
Both file encryption and hash (HMAC inclusive) have a progress event notifier for big files processing.

The multi-target libray (.NET Standard 2.0/2.1) can be used in projects with any .NET implementation like .NET Framework, .NET Core, Mono, Xamarin, etc. Verify the .NET Standard compatibility table here: https://github.com/dotnet/standard/blob/master/docs/versions.md

Currently symmetric encryption algorithms are:

  • AES 128 bits in CBC Mode with HMACSHA256 Authentication, using the Encrypt-then-MAC (EtM) strategy.
  • AES 192 bits in CBC Mode with HMACSHA384 Authentication, using the Encrypt-then-MAC (EtM) strategy.
  • AES 256 bits in CBC Mode with HMACSHA384 Authentication, using the Encrypt-then-MAC (EtM) strategy.
  • AES 256 bits in CBC Mode with HMACSHA512 Authentication, using the Encrypt-then-MAC (EtM) strategy.
  • AES 128 bits in GCM Mode with Authentication and Associated Data (AEAD).
  • AES 192 bits in GCM Mode with Authentication and Associated Data (AEAD).
  • AES 256 bits in GCM Mode with Authentication and Associated Data (AEAD).

Currently supported hash/KDF algorithms are:

  • MD5
  • SHA1
  • SHA256
  • SHA384
  • SHA512
  • HMAC-MD5
  • HMAC-SHA1
  • HMAC-SHA256
  • HMAC-SHA384
  • HMAC-SHA512
  • PBKDF2
  • BCrypt
  • Argon2id

Currently supported encoding types are:

  • Base64
  • Hexadecimal

Other encryption/hashing/kdf/encoding algorithms will be implemented in the future.

NuGet package: https://www.nuget.org/packages/CryptHash.Net

Compiled console utility binaries (single file self-contained / no framework dependent) for Windows (x86/x64/ARM), Linux (x64/ARM -> Raspberry Pi) and Mac (x64): https://github.com/alecgn/crypthash-net/releases/tag/v3.6.0. When running on Linux or Mac, don't forget to navigate to the program's folder and "chmod +x crypthash". For usage help, call the program without patameters or pass the "--help" parameter.

WARNING: PER SEMANTIC VERSIONING, THE ABOVE RELEASE (3.x.x) IS NOT COMPATIBLE WITH PREVIOUS RELEASES (1.x.x and 2.x.x), AND AS SUCH MIGHT NOT PROPERLY DECRYPT DATA YOU ENCRYPTED WITH PREVIOUS VERSIONS. From this version (3.x.x) onwards, any new implementations will be planned so as to maintain compatibility and stability. There should be no more breaking-changes, as the project's architecture and design are already well defined. If there is a need to make a breaking-change going forward then a method for properly decryting data you encryted with version 3.x.x will be provided.

Publish it yourself using the following dotnet client command-line:

dotnet publish -c Release -r <RID> /p:PublishSingleFile=true /p:PublishTrimmed=true


WINDOWS RIDs

Portable

  • win-x86
  • win-x64

Windows 7 / Windows Server 2008 R2

  • win7-x64
  • win7-x86

Windows 8 / Windows Server 2012

  • win8-x64
  • win8-x86
  • win8-arm

Windows 8.1 / Windows Server 2012 R2

  • win81-x64
  • win81-x86
  • win81-arm

Windows 10 / Windows Server 2016

  • win10-x64
  • win10-x86
  • win10-arm
  • win10-arm64

LINUX RIDs

ARM / Raspberry Pi (Raspbian)

  • linux-arm

Portable

  • linux-x64

CentOS

  • centos-x64
  • centos.7-x64

Debian

  • debian-x64
  • debian.8-x64

Fedora

  • fedora-x64
  • fedora.24-x64
  • fedora.25-x64 (.NET Core 2.0 or later versions)
  • fedora.26-x64 (.NET Core 2.0 or later versions)

Gentoo (.NET Core 2.0 or later versions)

  • gentoo-x64

openSUSE

  • opensuse-x64
  • opensuse.42.1-x64

Oracle Linux

  • ol-x64
  • ol.7-x64
  • ol.7.0-x64
  • ol.7.1-x64
  • ol.7.2-x64

Red Hat Enterprise Linux

  • rhel-x64
  • rhel.6-x64 (.NET Core 2.0 or later versions)
  • rhel.7-x64
  • rhel.7.1-x64
  • rhel.7.2-x64
  • rhel.7.3-x64 (.NET Core 2.0 or later versions)
  • rhel.7.4-x64 (.NET Core 2.0 or later versions)

Tizen (.NET Core 2.0 or later versions)

  • tizen

Ubuntu

  • ubuntu-x64
  • ubuntu.14.04-x64
  • ubuntu.14.10-x64
  • ubuntu.15.04-x64
  • ubuntu.15.10-x64
  • ubuntu.16.04-x64
  • ubuntu.16.10-x64

Ubuntu derivatives

  • linuxmint.17-x64
  • linuxmint.17.1-x64
  • linuxmint.17.2-x64
  • linuxmint.17.3-x64
  • linuxmint.18-x64
  • linuxmint.18.1-x64 (.NET Core 2.0 or later versions)

macOS RIDs

macOS RIDs use the older "OSX" branding.

  • osx-x64 (.NET Core 2.0 or later versions, minimum version is osx.10.12-x64)
  • osx.10.10-x64
  • osx.10.11-x64
  • osx.10.12-x64 (.NET Core 1.1 or later versions)
  • osx.10.13-x64

Complete RID LIST (https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)

crypthash-net's People

Contributors

alecgn avatar credsat-alessandro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crypthash-net's Issues

Ongoing support for .Net Framework 4.7.x and 4.8 (.Net Standard 2.0)

Alessandro,

It seems that project development is primary focused on .Net Standard 2.1 and .Net Core 3.0.

Do you intent to continue supporting .Net Framework 4.7.x and 4.8 (.Net Standard 2.0) for the foreseeable future?

I would like to start using your library but as we have a legacy Asp.Net solution which currently targets .Net Framework 4.7.2 we need a library that will at least continue to support .Net Framework 4.7.x and 4.8 (.Net Standard 2.0) into the foreseeable future as it'll take us a couple of years to complete rewriting the solution to target Asp.Net Core.

Les

EncryptionUtils.cs

Alessandro,

I just came across your project and it looks like a great library.

Whilst reviewing the code I noticed a couple things that look like possible bugs in EncryptionUtils.cs.

Firstly throughout EncryptionUtils.cs you seem to be referencing nameof(authKey) instead of nameof(dataBytes) in the ArgumentException calls for DataBaytes.

Secondly in ComputeHMACSHA512HashFromDataBytes you seem to have the messages in the ArgumentException calls for validating the authKey and DataBaytes reversed.

Thirdly in TagsMatch there is a typo with the word equal.

Les

PS: Can you explain the reasoning behind using the variable name tag instead of hash in some of the functions within EncryptionUtils.cs. To me variable name hash would be more appropriate and less likely to cause confusion with the use of the tag variable in the actual encryption functions.

AE_AES_128_CBC_HMAC_SHA_256 and AE_AES_192_CBC_HMAC_SHA_384 functions

Alessandro,

Are there plans to replace cryptSalt and authSalt with salt and derivedKey in the AE_AES_128_CBC_HMAC_SHA_256 and AE_AES_192_CBC_HMAC_SHA_384 functions like you have did to the AE_AES_256_CBC_HMAC_SHA_512 functions a few days ago?

If so is there a timeline for this?

I assume a future release with these changes would result in breaking a change from the 2.4.0 release as the values of EncryptedDataBytes and EncryptedDataBase64String in aesEncryptionResult would have changed from the 2.4.0 release.

Whilst I think this change is a good move I would have concerns about you making such breaking changes going forward if I was to start using this library.

Les

Use of encryptedFilePath variable name in DecryptFile functions

Alessandro,

I think the variable name "encryptedFilePath" in the DecryptFile functions that accept sourceFilePath and encryptedFilePath should be replaced with "decryptedFilePath" as it's extremely confusing when the "encryptedFilePath" variable from these functions gets passed to the "decryptedFilePath" variable on the function that does the actual decryption.

Furthermore I think it would be logical to replace the variable name "sourceFilePath" in those same functions with "encryptedFilePath" so their variables are consistent with function that does the actual decryption.

Les

Question: Is there a way to improve the performance?

Hi,

First of all, thank you for this great software.

I have a project running on NET48, i just notice when either encrypting or decrypting it takes about roughly 3 - 5 seconds.
by the way im using AE_AES_256_CBC_HMAC_SHA_512 class.

Just wondering is there a way to improve the processing time?

Update:
When trying to run the sample console application targeting netcoreapp3.1 its was much faster.

Thanks,
Jonathan

Update of Release Notes for releases containing breaking changes

Alessandro,

Can I suggest that where there are breaking changes in the encryption/decryption between releases that this is expressly mention that in the Release Notes for those releases on the Releases page.

I feel that this should be clearly mentioned in the release notes as merely updating the major version number (as per Semantic Versioning) is probably insufficient when it comes to making end users aware that files data/files encrypted by an earlier release can no longer be decrypted by this release.

End users often depend on the release notes to determine the impact on their project when evaluating whether they should to update to a new release.

This is because most open source developers / projects fail to state whether they're project uses Semantic Versioning or some other approach to versioning and most commercial developers update the major version number as a way to different between paid and free updates regardless of whether the update contains breaking changes.

I would even suggest it should you mention in the ReadMe that version 3.x is incompatible with previous releases and your thoughts/policy with respect to breaking changes going forward as this type of disclosure will give end users some confidence in using your library going forward.

Les

Typo in one of the variable names of DecryptFile

Alessandro,

I was reviewing the changes in commit 87e8a8e when I noticed that there appears to be a typo in one of the variable names in the calls to DecryptFile in the Tests.

I think "hasEncryptionDataAppendedInIntputFile" is meant to be "hasEncryptionDataAppendedInInputFile"

After pulling down a copy of the project and reviewing further within VS it appears that this Typo occurs in the DecryptFile variable names throughout the project.

Les

Use of aesDecriptionResult and aesDecryptionResult variables

Alessandro,

I think that the use of the variables "aesDecriptionResult" and "aesDecryptionResult" should be replaced with "AesEncryptionResult" for project consistency.

Alternatively you could add a "aesDecryptionResult" class and change the DecryptString and DecryptFile functions be of a "aesDecryptionResult" type and then update the "AesEncryptionResult" class to remove the fields related to decryption.

At the very least I think "aesDecriptionResult" should be replaced with "aesDecryptionResult" as I think that was a typo.

Les

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.