Git Product home page Git Product logo

pkcsextensions.blazor's Introduction

PkcsExtensions.Blazor

NuGet Status

Add crypto and digital signature functionality for Blazor and light WebCrypto interop.

Features

  • Namespace PkcsExtensions.Blazor:
    • IWebCryptoProvider - provide generate random numbers, generate RSA and ECDSA (as JsonWebKey) key pairs
    • IEcWebCryptoProvider - provide methods GetSharedDhmSecret for derive bytes using Diffie Hellman Merkle and GetSharedEphemeralDhmSecret for ECIES scheme.
  • Namespace PkcsExtensions.Blazor.Jwk - implementation of JsonWebKey
  • Namespace PkcsExtensions.Blazor.Security - extensions for System.Security.Cryptography

Usage

Install package dotnet add package PkcsExtensions.Blazor to Blazor WebAssebmly project.

Add to index.html:

<script src="_content/PkcsExtensions.Blazor/WebCryptoInterop.js"></script>

or minifiy version:

<script src="_content/PkcsExtensions.Blazor/WebCryptoInterop.min.js"></script>

And register services in Main method:

    public class Program
    {
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);
            builder.RootComponents.Add<App>("app");
            builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
            
            builder.Services.AddWebCryptoProvider();

            WebAssemblyHost host = builder.Build();
            await host.RunAsync();
        }
    }

Examples

See other examples.

Recommendations

  • Avoid use WebCyrpto for hashing, HMAC-ing, encryption, because their implementations has differs between browsers and operating systems. Use .Net implementation.
  • Avoid use WebCrypto for digital signing because it does not support hash signing.
  • Hint: Consider using high performance elliptic curves Curve25519, Ed25519 or similar. Use full managed implementation e.g. Chaos.NaCl library.

Read more

  1. PkcsExtensions
  2. WebCrypto support in browsers

pkcsextensions.blazor's People

Contributors

harrison314 avatar

Stargazers

Daniel Bichuetti avatar

Watchers

 avatar  avatar

pkcsextensions.blazor's Issues

Entropy collection area

Create area for collection entropy used mouse moove.

Or create friendly api for construt this area.

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.