Git Product home page Git Product logo

encryptions's Introduction

Hi there ๐Ÿ‘‹

I'm Riguz Lee, a full stack developer.

trophy

encryptions's People

Contributors

drriguz avatar gtteamamxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

encryptions's Issues

MissingPluginException

I'm unable to get this package to work. I receive the following error when I attempt to call argon2i.

MissingPluginException (MissingPluginException(No implementation found for method argon2i on channel encryptions))

this is my call:

 Argon2 argon2 = Argon2(iterations: 16, hashLength: 64, memory: 256, parallelism: 2);
 var hash = await argon2.argon2i(bytes, salt);

blake2.h:21:10: error: 'argon2.h' file not found with <angled> include; use "quotes" instead

Running Xcode build...

Xcode build done. 8.3s
Failed to build iOS app
Error output from Xcode build:
โ†ณ
** BUILD FAILED **

Xcode's output:
โ†ณ
While building module 'encryptions' imported from /Users/allen/huami/flutter/debugger/module/debugger_module/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m:26:
In file included from :1:
In file included from /Users/allen/huami/flutter/debugger/module/debugger_module/.ios/Pods/Target Support Files/encryptions/encryptions-umbrella.h:15:
/Users/allen/up up/flutter_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/encryptions-0.0.6/ios/Classes/argon2/blake2.h:21:10: error: 'argon2.h' file not found with include; use "quotes" instead
#include <argon2.h>
^~~~~~~~~~
"argon2.h"
1 error generated.
/Users/allen/huami/flutter/debugger/module/debugger_module/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m:26:9: fatal error: could not build module 'encryptions'
#import <encryptions/EncryptionsPlugin.h>
~~~~~~~^
2 errors generated.
error: the following command failed with exit code 1 but produced no further output
CompileC /Users/allen/Library/Developer/Xcode/DerivedData/Runner-cfbuvmlqqrfslnaeiullzkfptahb/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FlutterPluginRegistrant.build/Objects-normal/arm64/GeneratedPluginRegistrant.o
/Users/allen/huami/flutter/debugger/module/debugger_module/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Encountered error while building for device.

java.lang.NullPointerException: println needs a message

I had some problem about AES.ofECB Mode (AES-128)
Should plain be 16 bytes?

If the length is 16 bytes, there is no problem in use.

Uint8List key128 = hex.decode("323232323323232323232323232323232");
Uint8List plain = Uint8List.fromList("3232323232");
AES aes = AES.ofECB(key128, PaddingScheme.NoPadding);
Uint8List encrypted = await aes.encrypt(plain);

E/AndroidRuntime(24555): java.lang.NullPointerException: println needs a message
E/AndroidRuntime(24555): at android.util.Log.println_native(Native Method)
E/AndroidRuntime(24555): at android.util.Log.e(Log.java:240)
E/AndroidRuntime(24555): at com.riguz.encryptions.FlutterCallExecutor.execute(FlutterCallExecutor.java:82)
E/AndroidRuntime(24555): at com.riguz.encryptions.FlutterCallExecutor.access$000(FlutterCallExecutor.java:20)
E/AndroidRuntime(24555): at com.riguz.encryptions.FlutterCallExecutor$1.run(FlutterCallExecutor.java:53)
E/AndroidRuntime(24555): at java.lang.Thread.run(Thread.java:764)

uses a deprecated version of the Android embedding.

The plugin encryptions uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Hi, I working on a project using your plugin, it's great because it accepts Uint8List directly but I got this warning running on Android 11 phone. It's important to me to know if you are going to upgrade it in a future to use the new v2 Android embedding. Thanks!

Argon2 password verification

Hi :)

First of all, thanks for providing this library.
I just looked through your implementation and API docs, but I couldn't find a method to verify a password with given argon2 hash.

Did I overlook something or is this a feature that's planned to be added later on?
In case I overlooked it, it would be awesome to have an example added to the README of the project :)

Specifically from the argon2 string format. E.g.:

$argon2i$v=19$m=256,t=32,p=2$vyY1x5SY8kA3KiIng2BMkw$/BBUonur9Ph580Ip9Arrf4kfH+TnPJVjPyyaXuSWzxY

Thanks in advance!

No implementation found for method aesDecrypt on channel encryptions

plugin work under profile or debug mode but after build project with realease mode encryption, decryption not working, i tracking encryption, decryt log in realease mode with flutter logs and i get No implementation found for method aesDecrypt on channel encryptions exption when call decrypt method

my code

Uint8List _data = Uint8List.fromList(base64Decode(data));
final Uint8List iv = Uint8List.fromList(utf8.encode(aesIV));
final Uint8List key256 = Uint8List.fromList(utf8.encode(aesKey));
 AES aes = AES.ofCBC(key256, iv, PaddingScheme.PKCS5Padding);
_data = await aes.decrypt(_data);// i got exception here just after build release mode

Hash is always the same

Uint8List password = utf8.encode('password');
Uint8List salt = utf8.encode("ustamm");


Argon2 argon2 = Argon2(iterations: 16, hashLength: 32, memory: 256, parallelism: 2);
Uint8List hash = await argon2.argon2i(password, salt);
print('THIS IS HASH: ' + hash.toString());

Result is always:

THIS IS HASH: Argon2 params:16/2/256/32

Am I doing something wrong? Seems like the hashing does not return the salted & hashed password?!

Add several new features

Hello, thanks to this useful plugin, it is possible to add these few methods to iOS and Android ?
I want to encrypt and decrypt the file data and I even have a problem with big data using Isolate but using these methods solves my problem and I think it is useful.this is just an example of the code I added to solve my problem, it can be examined much better thanks

@Invokable("aesEncrypFile")
    public List<String> encryptFile(@Param("mode") String mode,
                          @Param("padding") String padding,
                          @Param("key") byte[] key,
                          @Param("iv") byte[] initVector,
                          @Param("path") String path,
                          @Param("split_length") int length)
            throws InvokeException {
        AES aes = createAES(mode, padding, key, initVector);
        File file = new File(path);
        int size = (int) file.length();
        byte[] bytes = new byte[size];
        try {
            try(BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file))){
                buf.read(bytes, 0, bytes.length);
                buf.close();
            }
            
            List<String> _data = splitsArray(aes.encrypt(bytes),split_length);
            return _data;
        }catch(FileNotFoundException e){
            e.printStackTrace();
            throw new InvokeException(e);
        }catch(IOException e){
            e.printStackTrace();
            throw new InvokeException(e);
        } catch (InvalidKeyException | IllegalBlockSizeException e) {
            e.printStackTrace();
            throw new InvokeException(e);
        }
    }

    @Invokable("aesDecryptFile")
    public boolean decryptFile(@Param("mode") String mode,
                          @Param("padding") String padding,
                          @Param("key") byte[] key,
                          @Param("iv") byte[] initVector,
                          @Param("encrypt_path") String encryptPat,
                          @Param("decrypt_path") String decryptPath)
            throws InvokeException {
        AES aes = createAES(mode, padding, key, initVector);
        File file = new File(encryptPat);
        File decryptFile = new File(decryptPath);
        int size = (int) file.length();
        byte[] bytes = new byte[size];
        try {
            try(BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file))){
                buf.read(bytes, 0, bytes.length);
                buf.close();
            }
            
            bytes  = aes.decrypt(bytes);
            try (FileOutputStream outputStream = new FileOutputStream(decryptFile)) {
            outputStream.write(bytes);
            }
            return true;
        }catch(FileNotFoundException e){
            e.printStackTrace();
            throw new InvokeException(e);
        }catch(IOException e){
            e.printStackTrace();
            throw new InvokeException(e);
        } catch (InvalidKeyException | IllegalBlockSizeException e) {
            e.printStackTrace();
            throw new InvokeException(e);
        }
    }
    public static List<String> splitsArray(byte[] source,int split_length) {

    List<String> result = new ArrayList<String>();
    int start = 0;
    while (start < source.length) {
        int end = Math.min(source.length, start + split_length);
        result.add(Base64.encodeToString(Arrays.copyOfRange(source, start, end), Base64.NO_WRAP));
        start += split_length;
    }
    result.add(Integer.toString(source.length));

    return result;
    }

Undecryptable block causes runtime crash

I/flutter ( 6655): payload to decrypt: [22, 5E, A9, 4F, 44, F2, 11, 00, 54, 69, 8A, 13, 95, 5F, 49, C1]
E/AndroidRuntime( 6655): FATAL EXCEPTION: Thread-9
E/AndroidRuntime( 6655): Process: com.xxxx.xxxxxxx PID: 6655
E/AndroidRuntime( 6655): java.lang.NullPointerException: println needs a message
E/AndroidRuntime( 6655): 	at android.util.Log.println_native(Native Method)
E/AndroidRuntime( 6655): 	at android.util.Log.e(Log.java:253)
E/AndroidRuntime( 6655): 	at com.riguz.encryptions.FlutterCallExecutor.execute(FlutterCallExecutor.java:79)
E/AndroidRuntime( 6655): 	at com.riguz.encryptions.FlutterCallExecutor.access$000(FlutterCallExecutor.java:18)
E/AndroidRuntime( 6655): 	at com.riguz.encryptions.FlutterCallExecutor$1.run(FlutterCallExecutor.java:51)
E/AndroidRuntime( 6655): 	at java.lang.Thread.run(Thread.java:923)
I/Process ( 6655): Sending signal. PID: 6655 SIG: 9

It's crashing when it can't decrypt, maybe throw an Exception here will be the solution, a callback onError(e): parameter in the method

edit:

I/flutter (30791): key Uint8List- [65, 67, 66, 50, 54, 55, 65, 67, 54, 65, 57, 68, 53, 54, 54, 65]
I/flutter (30791): iv Uint8List- [54, 65, 57, 68, 53, 54, 54, 65, 65, 67, 66, 50, 54, 55, 65, 67]

( not correctly encrypted) 
I/flutter (30791): data Uint8List- [211, 188, 12, 116, 12, 187, 37, 157, 34, 94, 173, 79, 68, 112, 17, 0]

AES aes = AES.ofCBC(key, iv, PaddingScheme.PKCS5Padding);
Uint8List decrypted = await aes.decrypt(data); <-crashes here

For sure the input data is malformed but there must be a way for not crashing the whole app.

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.