All Projects → daviddesmet → paseto-dotnet

daviddesmet / paseto-dotnet

Licence: MIT license
🔑 Paseto.NET, a Paseto (Platform-Agnostic Security Tokens) implementation for .NET

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to paseto-dotnet

Pcqq Protocol
PCQQ协议 机器人
Stars: ✭ 237 (+253.73%)
Mutual labels:  netstandard
Autofac.Configuration
Configuration support for Autofac IoC
Stars: ✭ 35 (-47.76%)
Mutual labels:  netstandard
Kendo.DynamicLinqCore
KendoNET.DynamicLinq implements server paging, filtering, sorting, grouping, and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 3.x).
Stars: ✭ 36 (-46.27%)
Mutual labels:  netstandard
Standard.licensing
Easy-to-use licensing library for .NET Framework, Mono, .NET Core, and Xamarin products
Stars: ✭ 239 (+256.72%)
Mutual labels:  netstandard
SharpAudio
Audio playback/capturing engine for C#
Stars: ✭ 139 (+107.46%)
Mutual labels:  netstandard
jpaseto
A library for creating and parsing Paseto in Java
Stars: ✭ 57 (-14.93%)
Mutual labels:  paseto
Asyncfriendlystacktrace
Async-friendly format for stack traces and exceptions
Stars: ✭ 205 (+205.97%)
Mutual labels:  netstandard
caddy-security
🔐 Authentication, Authorization, and Accounting (AAA) App and Plugin for Caddy v2. 💎 Implements Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0 (Github, Google, Facebook, Okta, etc.), SAML Authentication. MFA/2FA with App Authenticators and Yubico. 💎 Authorization with JWT/PASETO tokens. 🔐
Stars: ✭ 696 (+938.81%)
Mutual labels:  paseto
pasetors
PASETOrs: PASETO tokens in pure Rust
Stars: ✭ 46 (-31.34%)
Mutual labels:  paseto
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-68.66%)
Mutual labels:  netstandard
Typography
C# Font Reader (TrueType / OpenType / OpenFont / CFF / woff / woff2) , Glyphs Layout and Rendering
Stars: ✭ 246 (+267.16%)
Mutual labels:  netstandard
Vortice.Mathematics
Cross platform .NET math library.
Stars: ✭ 46 (-31.34%)
Mutual labels:  netstandard
aspnetcore-authentication-apikey
Easy to use and very light weight Microsoft style API Key Authentication Implementation for ASP.NET Core. It can be setup so that it can accept API Key in Header, Authorization Header, QueryParams or HeaderOrQueryParams.
Stars: ✭ 215 (+220.9%)
Mutual labels:  netstandard
Readableexpressions
A .NET 3.5+ and .NET Standard 1.0 library and set of Debugger Visualizers which translate Expression Trees into readable C# source code
Stars: ✭ 237 (+253.73%)
Mutual labels:  netstandard
Vulkan.NET
This repository contains low-level bindings for Vulkan used in Evergine.
Stars: ✭ 119 (+77.61%)
Mutual labels:  netstandard
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (+247.76%)
Mutual labels:  netstandard
EPPlus.Core.Extensions
An extensions library for EPPlus package to generate and manipulate Excel files easily.
Stars: ✭ 66 (-1.49%)
Mutual labels:  netstandard
mysql-connector-net-netstandard
ADO.NET driver for MySQL targeted against netstandard 1.3
Stars: ✭ 47 (-29.85%)
Mutual labels:  netstandard
dark-sky-core
A .NET Standard Library for using the Dark Sky API.
Stars: ✭ 55 (-17.91%)
Mutual labels:  netstandard
XamarinFormsPinView
PIN keyboard for Xamarin.Forms.
Stars: ✭ 83 (+23.88%)
Mutual labels:  netstandard

Paseto.NET, a Paseto (Platform-Agnostic Security Tokens) implementation for .NET

CI Build Status Maintenance contributions welcome

Features

PASETO protocols

purpose v1 v2 v3 v4
local
public

PASERK extension

type support
lid
local
seal
local-wrap
local-pw
sid
public
pid
secret
secret-wrap
secret-pw

Installation

NuGet

Install the Paseto.Core NuGet package from the .NET CLI using:

dotnet add package Paseto.Core

or from the NuGet package manager:

Install-Package Paseto.Core

Usage

PASETO

The library exposes a Fluent API with several method overloads found in Use(), WithKey(), AddClaim(), AddFooter() and so on to provide the flexibility needed for encoding and decoding PASETO tokens and also for generating the required symmetric or asymmetric key pairs. However, you can use the Protocols and Handlers directly if you like.

Below are a couple of examples for the most common use cases:

Generating a Symmetric Key

var pasetoKey = new PasetoBuilder().Use(version, Purpose.Local)
                                   .GenerateSymmetricKey();

Generating an Asymmetric Key Pair

var pasetoKey = new PasetoBuilder().Use(version, Purpose.Public)
                                   .GenerateAsymmetricKeyPair(seed);

NOTE: A seed is not required for protocol v1.

Generating a Token

var token = new PasetoBuilder().Use(version, purpose)
                               .WithKey(key)
                               .AddClaim("data", "this is a secret message")
                               .Issuer("https://github.com/daviddesmet/paseto-dotnet")
                               .Subject(Guid.NewGuid().ToString())
                               .Audience("https://paseto.io")
                               .NotBefore(DateTime.UtcNow.AddMinutes(5))
                               .IssuedAt(DateTime.UtcNow)
                               .Expiration(DateTime.UtcNow.AddHours(1))
                               .TokenIdentifier("123456ABCD")
                               .AddFooter("arbitrary-string-that-isn't-json")
                               .Encode();

Decoding a Token

var result = new PasetoBuilder().Use(version, purpose)
                                .WithKey(key)
                                .Decode(token);

Or validate the token's payload while decoding (the header and signature is always validated):

var valParams = new PasetoTokenValidationParameters
{
    ValidateLifetime = true,
    ValidateAudience = true,
    ValidateIssuer = true,
    ValidAudience = "https://paseto.io",
    ValidIssuer = "https://github.com/daviddesmet/paseto-dotnet"
};

var result = new PasetoBuilder().Use(version, purpose)
                                .WithKey(key)
                                .Decode(token, valParams);

PASERK

The library also provides the PASERK extension for encoding and decoding a key.

A serialized key in PASERK has the format:

k[version].[type].[data]

Encoding a Key

var paserk = Paserk.Encode(pasetoKey, type);

Decoding a Key

var key = Paserk.Decode(paserk);

Roadmap

  • Add support for remaining PASERK types and its operations.
  • Add support for version detection when decoding.
  • Add support for custom payload validation rules.
  • Improve documentation.
  • Remove dependency on JSON.NET.

Test Coverage

codecov

  • Includes the mandatory test vectors for PASETO and PASERK.

Cryptography

  • Uses Ed25519 (EdDSA over Curve25519) algorithm from CodesInChaos Chaos.NaCl cryptography library.
  • Uses Blake2b cryptographic hash function from Konscious.Security.Cryptography repository.
  • Uses AES-256-CTR, ECDSA over P-384 algorithms from Bouncy Castle cryptography library.
  • Uses XChaCha20-Poly1305 AEAD from NaCl.Core repository.

Learn More

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].