meta: Implement access to AES encryption (but fast)

This commit is contained in:
2022-10-04 23:37:32 +02:00
parent 4a89958351
commit 98c3355b44
35 changed files with 858 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
class AndroidCryptographyImplementation extends CryptographyImplementation {
final _methodChannel = const MethodChannel('me.polynom.moxplatform_android');
@override
Future<bool> encryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm) async {
final result = await _methodChannel.invokeMethod<bool>('encryptFile', [
sourcePath,
destPath,
key,
iv,
algorithm.toInt(),
]);
return result ?? false;
}
@override
Future<bool> decryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm) async {
final result = await _methodChannel.invokeMethod<bool>('decryptFile', [
sourcePath,
destPath,
key,
iv,
algorithm.toInt(),
]);
return result ?? false;
}
}

View File

@@ -1,3 +1,4 @@
import 'package:moxplatform_android/src/crypto_android.dart';
import 'package:moxplatform_android/src/isolate_android.dart';
import 'package:moxplatform_android/src/media_android.dart';
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
@@ -8,6 +9,7 @@ class MoxplatformAndroidPlugin extends MoxplatformInterface {
print('MoxplatformAndroidPlugin: Registering implementation');
MoxplatformInterface.handler = AndroidIsolateHandler();
MoxplatformInterface.media = AndroidMediaScannerImplementation();
MoxplatformInterface.crypto = AndroidCryptographyImplementation();
}
@override