Monocypher.NET:加密库Monocypher https的.NET包装器

  • o3_579830
    了解作者
  • 505.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-30 12:01
    上传日期
Monocypher.NET Monocypher.NET是围绕密码库的托管包装。 Monocypher.NET使用的当前Monocypher本机版本为3.1.2 特征 以高效的一对一映射提供整个本机Monocypher API: 身份验证加密(带有XChacha20和Poly1305 RFC 8439 ) 散列( Blake2b ) 密码密钥派生( Argon2i ) 密钥交换( X25519 ) 公钥签名(带有Blake2b和edwards25519 EdDSA (RFC 8032 )) ...... 使用Span / ReadOnlySpan参数,每个原始本机函数都将通过一个更友好的API进行复制。 与.NET 5.0+和.NET Standard 2.0+兼容 用法 使用 API的示例 // Use static at the beginning of your
Monocypher_NET-master.zip
内容介绍
# Monocypher<font color="FF8C44">.NET</font> [![Build Status](https://github.com/xoofx/Monocypher.NET/workflows/managed/badge.svg?branch=master)](https://github.com/xoofx/Monocypher.NET/actions) [![Build Status](https://github.com/xoofx/Monocypher.NET/workflows/native/badge.svg?branch=master)](https://github.com/xoofx/Monocypher.NET/actions) [![NuGet](https://img.shields.io/nuget/v/Monocypher.svg)](https://www.nuget.org/packages/Monocypher) Monocypher.NET is a managed wrapper around [Monocypher](https://github.com/LoupVaillant/Monocypher) cryptographic library. > The current _native_ version of Monocypher used by Monocypher.NET is `3.1.2` ## Features - Provides the entire native Monocypher API in an efficient 1-to-1 mapping: - Authenticated Encryption (`RFC 8439` with `XChacha20` and `Poly1305`) - Hashing (`Blake2b`) - Password Key Derivation (`Argon2i`) - Key Exchange (`X25519`) - Public Key Signatures (`EdDSA` (RFC `8032`) with Blake2b and `edwards25519`) - ...[and more](https://monocypher.org/manual/)... - Each raw native function is duplicated with a more friendly API using `Span`/`ReadOnlySpan` parameters. - Compatible with `.NET 5.0+` and `.NET Standard 2.0+` ## Usage Example of using the [`crypto_lock`](https://monocypher.org/manual/aead) API ```csharp // Use static at the beginning of your file to // import functions using static Monocypher.Monocypher; // ... // Message authentication code Span<byte> mac = stackalloc byte[16]; // Encrypted message Span<byte> cipherText = stackalloc byte[16]; // Secret message Span<byte> inputText = stackalloc byte[16]; inputText[0] = (byte)'a'; inputText[1] = (byte)'b'; inputText[2] = (byte)'c'; inputText[3] = (byte)'d'; // Random, secret session key Span<byte> key = stackalloc byte[32]; RNGCryptoServiceProvider.Fill(key); // Use only once per key Span<byte> nonce = stackalloc byte[24]; RNGCryptoServiceProvider.Fill(nonce); crypto_lock(mac, cipherText, key, nonce, inputText); // mac contains the authenticated code // cipherText contains the encrypted message ``` ## Documentation Because Monocypher.NET is a raw wrapper of Monocypher, the excellent [Monocypher manual](https://monocypher.org/manual/) can be used to easily dig into the API. For example, the `crypto_lock` C API defined like this: ```c void crypto_lock(uint8_t mac[16], uint8_t *cipher_text, const uint8_t key[32], const uint8_t nonce[24], const uint8_t *plain_text, size_t text_size); ``` is exposed with the following 2 functions in Monocypher.NET, one being a strict equivalent and the other using Span/ReadOnlySpan ```csharp // Pure translation of the C API public static void crypto_lock(ref Byte16 mac, IntPtr cipher_text, in Byte32 key, in Byte24 nonce, IntPtr plain_text, Monocypher.size_t text_size); // API using Span/ReadOnlySpan public static void crypto_lock(Span<byte> mac, Span<byte> cipher_text, ReadOnlySpan<byte> key, ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> plain_text) ``` ## Platforms Monocypher.NET is supported on the following platforms: - `win-x64`, `win-x86`, `win-arm64`, `win-arm` - `linux-x64`, `linux-arm64`, `linux-arm` - `osx-x64` ## Performance The primary usage for Monocypher is for resources constrained platforms (e.g micro-controllers) where the [code size and performance must be balanced](https://monocypher.org/speed). For .NET, this constraint might be less important, so if you are looking for the fastest cryptographic library, Monocypher.NET might not be the best candidate. That being said, if you are building an IoT project using the C Monocypher and you want to communicate with a .NET project, you might want to make sure that the cryptographic library used is the same between the client and the server (even though that's not strictly required). In that case **Monocypher.NET is a good compromise**. ## How to Build? You need to install the [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0). Then from the root folder: ```console $ dotnet build src -c Release ``` In order to rebuild the native binaries, you need to run the build scripts from [ext](ext/readme.md) ## Credits Monocypher.NET is just a wrapper and is entirely relying on the [Monocypher](https://monocypher.org/) C implementation developed by [Loup Vaillant](https://loup-vaillant.fr/). ## License This software is released under the [BSD-Clause 2 license](https://opensource.org/licenses/BSD-2-Clause). The native Monocypher is released with the following [BSD-Clause 2 license](https://github.com/LoupVaillant/Monocypher/blob/master/LICENCE.md) terms. ## Author Alexandre Mutel aka [xoofx](http://xoofx.com).
评论
    相关推荐
    • casparcg.net:https 的来源
      casparcg.net 这是的来源 欢迎所有修改或改进。
    • avaloniaui.net:https的来源
      avaloniaui.net-Avalonia UI网站 网站的源文件。 这是一个基于Razor Pages和Markdown文件渲染的ASP.Net Core项目。 先决条件 .Net Core 3.1 Visual Studio 2019或Visual Studio代码 建立和运行 视觉工作室 点击...
    • flashcrash.net:https
      完美的 Bootstrap Jekyll ... ... ... 安装说明 将存储库克隆到您的计算机。 使用终端,使用cd导航到perfect-jekyll目录。... 在目录中输入bundle exec jekyll serve --baseurl '' 。... 要使用 CSS: cd assets/stylesheets并运行...
    • .net 上下文
      NULL 博文链接:https://wzhelp.iteye.com/blog/428648
    • m.coding.net:https
      m.coding.net项目介绍 此项目为m.coding.net的前端代码,初始化api和coding.net一致,通过跨域ajax请求域名下的api实现数据通信。实际开发过程中可能会因为本地域名导致CORS限制以至至于无法获取数据。具体解决方案...
    • .net 上下文
      NULL 博文链接:https://wzhelp.iteye.com/blog/428648
    • .net asp初探
      NULL 博文链接:https://lengyue.iteye.com/blog/318666
    • .NET Remoting Callback
      博文链接:https://taowen.iteye.com/blog/131531
    • opencv.net:来自 https
      OpenCV.NET 是流行的 OpenCV 计算机视觉和图像处理库的 .NET 接口。 这些绑定是在一年内开发的,包括许多其他尝试中缺少的功能,即: 跨平台 Mono 兼容性(仅使用 P/Invoke) 非常接近 100% 支持最新的 C API...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档