Giter Club home page Giter Club logo

skye10da / flutter-rsa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jerson/flutter-rsa

0.0 0.0 0.0 237.11 MB

RSA for flutter made with golang for fast performance with support for android, ios, macos, linux, windows, web and hover

Home Page: https://pub.dev/packages/fast_rsa

License: MIT License

Shell 1.16% JavaScript 6.82% Ruby 1.65% C++ 9.63% C 5.71% Objective-C 0.23% Java 0.42% Go 0.87% Kotlin 0.04% Dart 65.87% Swift 0.75% Makefile 0.10% HTML 0.52% CMake 6.14% Dockerfile 0.09%

flutter-rsa's Introduction

Fast RSA

Library for use RSA with support for android, ios, macos, windows, linux, web and hover

Integration Tests Android

Integration Tests Linux

Integration Tests Windows

Integration Tests iOS

Integration Tests macOS

Contents

Usage

Encrypt methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.encryptOAEP(message, label, Hash.HASH_SHA256, publicKey)
var result = await RSA.encryptPKCS1v15(message, publicKey)

var result = await RSA.encryptOAEPBytes(messageBytes, label, Hash.HASH_SHA256, publicKey)
var result = await RSA.encryptPKCS1v15Bytes(messageBytes, publicKey)

Decrypt methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.decryptOAEP(message, label, Hash.HASH_SHA256, privateKey)
var result = await RSA.decryptPKCS1v15(message, privateKey)

var result = await RSA.decryptOAEPBytes(messageBytes, label, Hash.HASH_SHA256, privateKey)
var result = await RSA.decryptPKCS1v15Bytes(messageBytes, privateKey)

Sign methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.signPSS(message, Hash.HASH_SHA256, SaltLength.SALTLENGTH_AUTO, privateKey)
var result = await RSA.signPKCS1v15(message, Hash.HASH_SHA256, privateKey)

var result = await RSA.signPSSBytes(messageBytes, Hash.HASH_SHA256, SaltLength.SALTLENGTH_AUTO, privateKey)
var result = await RSA.signPKCS1v15Bytes(messageBytes, Hash.HASH_SHA256, privateKey)

Verify methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.verifyPSS(signature, message, Hash.HASH_SHA256, SaltLength.SALTLENGTH_AUTO, publicKey)
var result = await RSA.verifyPKCS1v15(signature, message, Hash.HASH_SHA256, publicKey)

var result = await RSA.verifyPSSBytes(signatureBytes, messageBytes, Hash.HASH_SHA256, SaltLength.SALTLENGTH_AUTO, publicKey)
var result = await RSA.verifyPKCS1v15Bytes(signatureBytes, messageBytes, Hash.HASH_SHA256, publicKey)

Generate Methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.generate(2048)

Convert Methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.convertJWKToPrivateKey(data, keyId)
var result = await RSA.convertJWKToPublicKey(data, keyId)

var result = await RSA.convertKeyPairToPKCS12(privateKey, certificate, password)
var result = await RSA.convertPKCS12ToKeyPair(pkcs12, password)

var result = await RSA.convertPrivateKeyToPKCS8(privateKey)
var result = await RSA.convertPrivateKeyToPKCS1(privateKey)
var result = await RSA.convertPrivateKeyToJWK(privateKey)

var result = await RSA.convertPrivateKeyToPublicKey(privateKey)

var result = await RSA.convertPublicKeyToPKIX(publicKey)
var result = await RSA.convertPublicKeyToPKCS1(publicKey)
var result = await RSA.convertPublicKeyToJWK(publicKey)

var result = await RSA.encryptPrivateKey(privateKey, password, PEMCipher.PEMCIPHER_AES256)
var result = await RSA.decryptPrivateKey(privateKeyEncrypted, password)

Util Methods

import 'package:fast_rsa/fast_rsa.dart';

var result = await RSA.hash(message, Hash.HASH_SHA256)
var result = await RSA.base64(message)

Setup

Android

No additional setup required.

iOS

No additional setup required.

Web

add to you pubspec.yaml

assets:
  - packages/fast_rsa/web/assets/worker.js
  - packages/fast_rsa/web/assets/wasm_exec.js
  - packages/fast_rsa/web/assets/rsa.wasm

ref: https://github.com/jerson/flutter-rsa/blob/master/example/pubspec.yaml

MacOS

no additional setup required

Hover

Update your plugins.

hover plugins get

In you main_desktop.dart by now you need to add RSA.bindingEnabled = false in order to use channels instead of shared objects

import 'main.dart' as original_main;
import 'package:fast_rsa/fast_rsa.dart';

void main() {
  RSA.bindingEnabled = false;
  original_main.main();
}

Linux

No additional setup required.

Windows

No additional setup required.

Example

Inside example folder

cd example && flutter run

check our web demo: [https://flutter-rsa.jerson.dev/]

Native Code

the native library is made in Golang and build with gomobile for faster performance

https://github.com/jerson/rsa-mobile

flutter-rsa's People

Contributors

jerson avatar martingeorgiu avatar

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.