Rabe.Core 1.0.3

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Rabe.Core --version 1.0.3
NuGet\Install-Package Rabe.Core -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rabe.Core" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rabe.Core --version 1.0.3
#r "nuget: Rabe.Core, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rabe.Core as a Cake Addin
#addin nuget:?package=Rabe.Core&version=1.0.3

// Install Rabe.Core as a Cake Tool
#tool nuget:?package=Rabe.Core&version=1.0.3

This library is rust Attribute-Based Encryption library rabe's C# binding , support CP-ABE and KP-ABE encrypt and decrypt.

  • Provide cipher and key json serialization and deserialization with System.Text.Json.
  • Only support windows-x64, linux-x64 and osx-arm64 now.
  • Only support FAME scheme now, support other scheme soon.
    Usage:
using System;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using Rabe;
using NUnit.Framework;

namespace Test;

public class Tests
{
    private MasterKey _masterKey;
    private PublicKey _publicKey;
    [SetUp]
    public void Setup()
    {
        var (publicKey, masterKey) = RabeContext.Init();
        _masterKey = masterKey;
        _publicKey = publicKey;
    }

    [Test]
    public void CPABETest()
    {
        Rabe.CPABE.SecretKey secretKey = Rabe.CPABE.Extension.KeyGen(_masterKey,new string[]{"A"});
        var secretKeyJson = JsonSerializer.Serialize(secretKey, new JsonSerializerOptions
        {
            Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
            WriteIndented = true,
        });
        Console.WriteLine(secretKeyJson);
        var secretKeyDeserialized = JsonSerializer.Deserialize<Rabe.CPABE.SecretKey>(secretKeyJson);
        var message = Encoding.Default.GetBytes("Hello world!");
        var cipher = Rabe.CPABE.Extension.Encrypt(_publicKey,"\"A\" or \"B\"", message );
        var cipherJson = JsonSerializer.Serialize(cipher, new JsonSerializerOptions
        {
            Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
            WriteIndented = true,
        });
        Console.WriteLine(cipherJson);
        var cipherDeserialized = JsonSerializer.Deserialize<Rabe.CPABE.Cipher>(cipherJson);
        var text = secretKeyDeserialized.Decrypt(cipherDeserialized);
        Assert.AreEqual(text,message);
    }
    
    [Test]
    public void KPABETest()
    {
        Rabe.KPABE.SecretKey secretKey = Rabe.KPABE.Extension.KeyGen(_masterKey,"\"A\" and \"B\"");
        var secretKeyJson = JsonSerializer.Serialize(secretKey, new JsonSerializerOptions
        {
            Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
            WriteIndented = true,
        });
        Console.WriteLine(secretKeyJson);
        var secretKeyDeserialized = JsonSerializer.Deserialize<Rabe.KPABE.SecretKey>(secretKeyJson);
        var message = Encoding.Default.GetBytes("Hello world!");
        var cipher = Rabe.KPABE.Extension.Encrypt(_publicKey,new string[]{"A", "B"}, message );
        var cipherJson = JsonSerializer.Serialize(cipher, new JsonSerializerOptions
        {
            Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
            WriteIndented = true,
        });
        Console.WriteLine(cipherJson);
        var cipherDeserialized = JsonSerializer.Deserialize<Rabe.KPABE.Cipher>(cipherJson);
        var text = secretKeyDeserialized.Decrypt(cipherDeserialized);
        Assert.AreEqual(text,message);
    }
    
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 170 5/11/2023