Skip to content

Commit

Permalink
Merge pull request #18 from jerson/flatbuffers
Browse files Browse the repository at this point in the history
Flatbuffers
  • Loading branch information
jerson authored Jul 8, 2021
2 parents c4839e4 + fdfec02 commit 7578246
Show file tree
Hide file tree
Showing 45 changed files with 5,347 additions and 4,952 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.0

- First version with flatbuffers, smaller binaries, please take a look
## 2.0.1

- Support import .so for older android versions, thanks to @BobanLW
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ upgrade: upgrade-libs upgrade-protobuf
upgrade-libs:
./scripts/upgrade_bridge_libs.sh

upgrade-protobuf:
./scripts/upgrade_bridge_protobuf.sh
upgrade-flatbuffers:
./scripts/upgrade_bridge_flatbuffers.sh

example-web:
docker build -t flutter-rsa-web -f example/Dockerfile .
Binary file modified android/src/main/jniLibs/arm64-v8a/librsa_bridge.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/armeabi-v7a/librsa_bridge.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86/librsa_bridge.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86_64/librsa_bridge.so
Binary file not shown.
4 changes: 2 additions & 2 deletions example/lib/base64.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -15,7 +15,7 @@ class Base64 extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
4 changes: 2 additions & 2 deletions example/lib/convert_jwt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class ConvertJWT extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
4 changes: 2 additions & 2 deletions example/lib/convert_keypair.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class ConvertKeyPair extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
4 changes: 2 additions & 2 deletions example/lib/convert_private.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class ConvertPrivate extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
4 changes: 2 additions & 2 deletions example/lib/convert_public.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class ConvertPublic extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
8 changes: 4 additions & 4 deletions example/lib/encrypt_decrypt_oaep.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -15,7 +15,7 @@ class EncryptAndDecryptOAEP extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -45,7 +45,7 @@ class _EncryptAndDecryptOAEPState extends State<EncryptAndDecryptOAEP> {
var encrypted = await RSA.encryptOAEP(
controller.text,
"",
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.publicKey,
);
setState(() {
Expand All @@ -61,7 +61,7 @@ class _EncryptAndDecryptOAEPState extends State<EncryptAndDecryptOAEP> {
var decrypted = await RSA.decryptOAEP(
_encrypted,
"",
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.privateKey,
);
setState(() {
Expand Down
8 changes: 4 additions & 4 deletions example/lib/encrypt_decrypt_oaep_bytes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class EncryptAndDecryptOAEPBytes extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -48,7 +48,7 @@ class _EncryptAndDecryptOAEPBytesState
var encrypted = await RSA.encryptOAEPBytes(
Uint8List.fromList(controller.text.codeUnits),
"",
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.publicKey,
);
setState(() {
Expand All @@ -64,7 +64,7 @@ class _EncryptAndDecryptOAEPBytesState
var decrypted = await RSA.decryptOAEPBytes(
base64Decode(_encrypted),
"",
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.privateKey,
);
setState(() {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/encrypt_decrypt_pkcs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -15,7 +15,7 @@ class EncryptAndDecryptPKCS extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
4 changes: 2 additions & 2 deletions example/lib/encrypt_decrypt_pkcs_bytes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class EncryptAndDecryptPKCSBytes extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down
8 changes: 4 additions & 4 deletions example/lib/encrypt_sign_pkcs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -15,7 +15,7 @@ class SignAndVerifyPKCS extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -45,7 +45,7 @@ class _SignAndVerifyPKCSState extends State<SignAndVerifyPKCS> {
onPressed: (controller) async {
var result = await RSA.signPKCS1v15(
controller.text,
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.privateKey,
);
setState(() {
Expand All @@ -62,7 +62,7 @@ class _SignAndVerifyPKCSState extends State<SignAndVerifyPKCS> {
var result = await RSA.verifyPKCS1v15(
_signed,
_text,
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.publicKey,
);
setState(() {
Expand Down
8 changes: 4 additions & 4 deletions example/lib/encrypt_sign_pkcs_bytes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class SignAndVerifyPKCSBytes extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -46,7 +46,7 @@ class _SignAndVerifyPKCSBytesState extends State<SignAndVerifyPKCSBytes> {
onPressed: (controller) async {
var result = await RSA.signPKCS1v15Bytes(
Uint8List.fromList(controller.text.codeUnits),
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.privateKey,
);
setState(() {
Expand All @@ -63,7 +63,7 @@ class _SignAndVerifyPKCSBytesState extends State<SignAndVerifyPKCSBytes> {
var result = await RSA.verifyPKCS1v15Bytes(
base64Decode(_signed),
Uint8List.fromList(_text.codeUnits),
Hash.HASH_SHA256,
Hash.SHA256,
widget.keyPair.publicKey,
);
setState(() {
Expand Down
12 changes: 6 additions & 6 deletions example/lib/encrypt_sign_pss.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -15,7 +15,7 @@ class SignAndVerifyPSS extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -45,8 +45,8 @@ class _SignAndVerifyPSSState extends State<SignAndVerifyPSS> {
onPressed: (controller) async {
var result = await RSA.signPSS(
controller.text,
Hash.HASH_SHA256,
SaltLength.SALTLENGTH_AUTO,
Hash.SHA256,
SaltLength.AUTO,
widget.keyPair.privateKey,
);
setState(() {
Expand All @@ -63,8 +63,8 @@ class _SignAndVerifyPSSState extends State<SignAndVerifyPSS> {
var result = await RSA.verifyPSS(
_signed,
_text,
Hash.HASH_SHA256,
SaltLength.SALTLENGTH_AUTO,
Hash.SHA256,
SaltLength.AUTO,
widget.keyPair.publicKey,
);
setState(() {
Expand Down
12 changes: 6 additions & 6 deletions example/lib/encrypt_sign_pss_bytes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/main.dart';
import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
Expand All @@ -16,7 +16,7 @@ class SignAndVerifyPSSBytes extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand Down Expand Up @@ -46,8 +46,8 @@ class _SignAndVerifyPSSBytesState extends State<SignAndVerifyPSSBytes> {
onPressed: (controller) async {
var result = await RSA.signPSSBytes(
Uint8List.fromList(controller.text.codeUnits),
Hash.HASH_SHA256,
SaltLength.SALTLENGTH_AUTO,
Hash.SHA256,
SaltLength.AUTO,
widget.keyPair.privateKey,
);
setState(() {
Expand All @@ -64,8 +64,8 @@ class _SignAndVerifyPSSBytesState extends State<SignAndVerifyPSSBytes> {
var result = await RSA.verifyPSSBytes(
base64Decode(_signed),
Uint8List.fromList(_text.codeUnits),
Hash.HASH_SHA256,
SaltLength.SALTLENGTH_AUTO,
Hash.SHA256,
SaltLength.AUTO,
widget.keyPair.publicKey,
);
setState(() {
Expand Down
8 changes: 3 additions & 5 deletions example/lib/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:fast_rsa/model/bridge.pb.dart';

import 'package:rsa_example/shared/button_widget.dart';
import 'package:rsa_example/shared/input_widget.dart';
import 'package:rsa_example/shared/title_widget.dart';
Expand All @@ -14,7 +14,7 @@ class Generate extends StatefulWidget {
Key? key,
required this.title,
required PKCS12KeyPair keyPair,
}) : keyPair = keyPair,
}) : keyPair = keyPair,
super(key: key);

final PKCS12KeyPair keyPair;
Expand All @@ -25,9 +25,7 @@ class Generate extends StatefulWidget {
}

class _GenerateState extends State<Generate> {
KeyPair _keyPair = KeyPair()
..privateKey = ""
..publicKey = "";
KeyPair _keyPair = KeyPair("", "");

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit 7578246

Please sign in to comment.