diff --git a/native_crypto_android/.gitignore b/native_crypto_android/.gitignore
new file mode 100644
index 0000000..9be145f
--- /dev/null
+++ b/native_crypto_android/.gitignore
@@ -0,0 +1,29 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
+/pubspec.lock
+**/doc/api/
+.dart_tool/
+.packages
+build/
diff --git a/native_crypto_android/.metadata b/native_crypto_android/.metadata
new file mode 100644
index 0000000..8c15ad7
--- /dev/null
+++ b/native_crypto_android/.metadata
@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
+ channel: stable
+
+project_type: plugin
diff --git a/native_crypto_android/CHANGELOG.md b/native_crypto_android/CHANGELOG.md
new file mode 100644
index 0000000..403c448
--- /dev/null
+++ b/native_crypto_android/CHANGELOG.md
@@ -0,0 +1 @@
+Check [`native_crypto`](../native_crypto/CHANGELOG.md) plugin's changelog.
\ No newline at end of file
diff --git a/native_crypto_android/LICENSE b/native_crypto_android/LICENSE
new file mode 100644
index 0000000..dd5d33b
--- /dev/null
+++ b/native_crypto_android/LICENSE
@@ -0,0 +1,23 @@
+NativeCrypto - Android Implementation
+
+MIT License
+
+Copyright (c) 2019 - 2022 Hugo Pointcheval
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/native_crypto_android/README.md b/native_crypto_android/README.md
new file mode 100644
index 0000000..48b93a5
--- /dev/null
+++ b/native_crypto_android/README.md
@@ -0,0 +1,15 @@
+# native_crypto_android
+
+A new flutter plugin project.
+
+## Getting Started
+
+This project is a starting point for a Flutter
+[plug-in package](https://flutter.dev/developing-packages/),
+a specialized package that includes platform-specific implementation code for
+Android and/or iOS.
+
+For help getting started with Flutter, view our
+[online documentation](https://flutter.dev/docs), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
+
diff --git a/native_crypto_android/android/.gitignore b/native_crypto_android/android/.gitignore
new file mode 100644
index 0000000..c6cbe56
--- /dev/null
+++ b/native_crypto_android/android/.gitignore
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/native_crypto_android/android/build.gradle b/native_crypto_android/android/build.gradle
new file mode 100644
index 0000000..ec447a5
--- /dev/null
+++ b/native_crypto_android/android/build.gradle
@@ -0,0 +1,50 @@
+group 'fr.pointcheval.native_crypto_android'
+version '1.0-SNAPSHOT'
+
+buildscript {
+ ext.kotlin_version = '1.3.50'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+rootProject.allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+android {
+ compileSdkVersion 30
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ defaultConfig {
+ minSdkVersion 26
+ }
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+}
diff --git a/native_crypto_android/android/gradle/wrapper/gradle-wrapper.jar b/native_crypto_android/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..e708b1c
Binary files /dev/null and b/native_crypto_android/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/native_crypto_android/android/gradle/wrapper/gradle-wrapper.properties b/native_crypto_android/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..da9702f
--- /dev/null
+++ b/native_crypto_android/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/native_crypto_android/android/gradlew b/native_crypto_android/android/gradlew
new file mode 100755
index 0000000..4f906e0
--- /dev/null
+++ b/native_crypto_android/android/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/native_crypto_android/android/gradlew.bat b/native_crypto_android/android/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/native_crypto_android/android/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/native_crypto_android/android/settings.gradle b/native_crypto_android/android/settings.gradle
new file mode 100644
index 0000000..3533b9f
--- /dev/null
+++ b/native_crypto_android/android/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'native_crypto_android'
diff --git a/native_crypto_android/android/src/main/AndroidManifest.xml b/native_crypto_android/android/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..a750e9f
--- /dev/null
+++ b/native_crypto_android/android/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Cipher.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Cipher.kt
new file mode 100644
index 0000000..78b1a79
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Cipher.kt
@@ -0,0 +1,6 @@
+package fr.pointcheval.native_crypto_android
+
+abstract class Cipher {
+ abstract fun encrypt(data: ByteArray, key: ByteArray) : ByteArray?;
+ abstract fun decrypt(data: ByteArray, key: ByteArray) : ByteArray?;
+}
\ No newline at end of file
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Hash.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Hash.kt
new file mode 100644
index 0000000..dd9c95e
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Hash.kt
@@ -0,0 +1,25 @@
+package fr.pointcheval.native_crypto_android
+
+import java.security.MessageDigest
+
+object Hash {
+ fun digest(data: ByteArray?, algorithm: HashAlgorithm): ByteArray {
+ val func : String = when (algorithm) {
+ HashAlgorithm.SHA256 -> "SHA-256"
+ HashAlgorithm.SHA384 -> "SHA-384"
+ HashAlgorithm.SHA512 -> "SHA-512"
+ }
+ val md = MessageDigest.getInstance(func)
+ return md.digest(data)
+ }
+
+ fun digest(data: ByteArray?, algorithm: String): ByteArray {
+ val func : HashAlgorithm = when (algorithm) {
+ "sha256" -> HashAlgorithm.SHA256
+ "sha384" -> HashAlgorithm.SHA384
+ "sha512" -> HashAlgorithm.SHA512
+ else -> HashAlgorithm.SHA256
+ }
+ return digest(data, func)
+ }
+}
\ No newline at end of file
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/HashAlgorithm.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/HashAlgorithm.kt
new file mode 100644
index 0000000..f820bae
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/HashAlgorithm.kt
@@ -0,0 +1,15 @@
+package fr.pointcheval.native_crypto_android
+
+enum class HashAlgorithm(val length : Int) {
+ SHA256(256),
+ SHA384(384),
+ SHA512(512);
+
+ fun hmac(): String {
+ return when (this) {
+ HashAlgorithm.SHA256 -> "HmacSHA256"
+ HashAlgorithm.SHA384 -> "HmacSHA384"
+ HashAlgorithm.SHA512 -> "HmacSHA512"
+ }
+ }
+}
\ No newline at end of file
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Key.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Key.kt
new file mode 100644
index 0000000..d099a89
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/Key.kt
@@ -0,0 +1,24 @@
+package fr.pointcheval.native_crypto_android
+
+import java.security.SecureRandom
+import javax.crypto.SecretKeyFactory
+import javax.crypto.spec.PBEKeySpec
+
+object Key {
+ fun fromSecureRandom(bitsCount: Int) : ByteArray {
+ val bytes = ByteArray(bitsCount / 8)
+ SecureRandom.getInstanceStrong().nextBytes(bytes)
+ return bytes
+ }
+
+ fun fromPBKDF2(password: String, salt: String, keyBytesCount: Int, iterations: Int, algorithm: String): ByteArray {
+ val availableHashAlgorithm: Map = mapOf(
+ "sha256" to "PBKDF2WithHmacSHA256",
+ "sha384" to "PBKDF2withHmacSHA384",
+ "sha512" to "PBKDF2withHmacSHA512"
+ )
+ val spec = PBEKeySpec(password.toCharArray(), salt.toByteArray(), iterations, keyBytesCount * 8)
+ val skf: SecretKeyFactory = SecretKeyFactory.getInstance(availableHashAlgorithm[algorithm])
+ return skf.generateSecret(spec).encoded
+ }
+}
\ No newline at end of file
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/NativeCryptoAndroidPlugin.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/NativeCryptoAndroidPlugin.kt
new file mode 100644
index 0000000..04270a8
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/NativeCryptoAndroidPlugin.kt
@@ -0,0 +1,77 @@
+package fr.pointcheval.native_crypto_android
+
+import androidx.annotation.NonNull
+import fr.pointcheval.native_crypto_android.ciphers.AESCipher
+
+import io.flutter.embedding.engine.plugins.FlutterPlugin
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+import io.flutter.plugin.common.MethodChannel.MethodCallHandler
+import io.flutter.plugin.common.MethodChannel.Result
+
+/** NativeCryptoAndroidPlugin */
+class NativeCryptoAndroidPlugin: FlutterPlugin, MethodCallHandler {
+ /// The MethodChannel that will the communication between Flutter and native Android
+ ///
+ /// This local reference serves to register the plugin with the Flutter Engine and unregister it
+ /// when the Flutter Engine is detached from the Activity
+ private lateinit var channel : MethodChannel
+
+ override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
+ channel = MethodChannel(flutterPluginBinding.binaryMessenger, "plugins.hugop.cl/native_crypto")
+ channel.setMethodCallHandler(this)
+ }
+
+ override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
+ when (call.method) {
+ "digest" -> {
+ val data : ByteArray? = call.argument("data")
+ val algorithm : String? = call.argument("algorithm")
+ // TODO(hpcl): check if algorithm is null
+ // TODO(hpcl): check if digest is null
+ result.success(Hash.digest(data, algorithm!!))
+ }
+ "generateSecretKey" -> {
+ val bitsCount : Int? = call.argument("bitsCount")
+ // TODO(hpcl): check null
+ result.success(Key.fromSecureRandom(bitsCount!!))
+ }
+ "generateKeyPair" -> {
+ result.notImplemented()
+ }
+ "pbkdf2" -> {
+ val password : String? = call.argument("password")
+ val salt : String? = call.argument("salt")
+ val keyBytesCount : Int? = call.argument("keyBytesCount")
+ val iterations : Int? = call.argument("iterations")
+ val algorithm : String? = call.argument("algorithm")
+ // TODO(hpcl): check null
+ result.success(Key.fromPBKDF2(password!!, salt!!, keyBytesCount!!, iterations!!, algorithm!!))
+ }
+ "encrypt" -> {
+ val data : ByteArray? = call.argument("data")
+ val key : ByteArray? = call.argument("key")
+ val algorithm : String? = call.argument("algorithm")
+ // TODO(hpcl): check null
+ // TODO(hcpl): check algorithm
+ result.success(AESCipher().encrypt(data!!, key!!))
+ }
+ "decrypt" -> {
+ val data : ByteArray? = call.argument("data")
+ val key : ByteArray? = call.argument("key")
+ val algorithm : String? = call.argument("algorithm")
+ // TODO(hpcl): check null
+ // TODO(hcpl): check algorithm
+ result.success(AESCipher().decrypt(data!!, key!!))
+ }
+ "generateSharedSecretKey" -> {
+ result.notImplemented()
+ }
+ else -> result.notImplemented()
+ }
+ }
+
+ override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
+ channel.setMethodCallHandler(null)
+ }
+}
diff --git a/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/ciphers/AESCipher.kt b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/ciphers/AESCipher.kt
new file mode 100644
index 0000000..941cfde
--- /dev/null
+++ b/native_crypto_android/android/src/main/kotlin/fr/pointcheval/native_crypto_android/ciphers/AESCipher.kt
@@ -0,0 +1,31 @@
+package fr.pointcheval.native_crypto_android.ciphers
+
+import fr.pointcheval.native_crypto_android.Cipher
+import javax.crypto.SecretKey
+import javax.crypto.spec.GCMParameterSpec
+import javax.crypto.spec.SecretKeySpec
+
+class AESCipher : Cipher() {
+ override fun encrypt(data: ByteArray, key: ByteArray): ByteArray {
+ val sk: SecretKey = SecretKeySpec(key, "AES")
+ val cipher = javax.crypto.Cipher.getInstance("AES/GCM/NoPadding")
+ cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, sk)
+ // javax.crypto representation = [CIPHERTEXT(n-28) || TAG(16)]
+ val bytes = cipher.doFinal(data)
+ val iv = cipher.iv.copyOf() // 12 bytes nonce
+ // native.crypto representation = [NONCE(12) || CIPHERTEXT(n-28) || TAG(16)]
+ return iv.plus(bytes)
+ }
+
+ override fun decrypt(data: ByteArray, key: ByteArray): ByteArray? {
+ val sk: SecretKey = SecretKeySpec(key, "AES")
+ // native.crypto representation = [NONCE(12) || CIPHERTEXT(n-28) || TAG(16)]
+ val iv = data.sliceArray(IntRange(0,11)) // 12 bytes nonce
+ // javax.crypto representation = [CIPHERTEXT(n-28) || TAG(16)]
+ val payload = data.sliceArray(IntRange(12, data.size - 1))
+ val spec = GCMParameterSpec(16 * 8, iv)
+ val cipher = javax.crypto.Cipher.getInstance("AES/GCM/NoPadding")
+ cipher.init(javax.crypto.Cipher.DECRYPT_MODE, sk, spec)
+ return cipher.doFinal(payload)
+ }
+}
\ No newline at end of file
diff --git a/native_crypto_android/example/.gitignore b/native_crypto_android/example/.gitignore
new file mode 100644
index 0000000..0fa6b67
--- /dev/null
+++ b/native_crypto_android/example/.gitignore
@@ -0,0 +1,46 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+**/ios/Flutter/.last_build_id
+.dart_tool/
+.flutter-plugins
+.flutter-plugins-dependencies
+.packages
+.pub-cache/
+.pub/
+/build/
+
+# Web related
+lib/generated_plugin_registrant.dart
+
+# Symbolication related
+app.*.symbols
+
+# Obfuscation related
+app.*.map.json
+
+# Android Studio will place build artifacts here
+/android/app/debug
+/android/app/profile
+/android/app/release
diff --git a/native_crypto_android/example/.metadata b/native_crypto_android/example/.metadata
new file mode 100644
index 0000000..fd70cab
--- /dev/null
+++ b/native_crypto_android/example/.metadata
@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
+ channel: stable
+
+project_type: app
diff --git a/native_crypto_android/example/README.md b/native_crypto_android/example/README.md
new file mode 100644
index 0000000..8490cfc
--- /dev/null
+++ b/native_crypto_android/example/README.md
@@ -0,0 +1,16 @@
+# native_crypto_android_example
+
+Demonstrates how to use the native_crypto_android plugin.
+
+## Getting Started
+
+This project is a starting point for a Flutter application.
+
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
+
+For help getting started with Flutter, view our
+[online documentation](https://flutter.dev/docs), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
diff --git a/native_crypto_android/example/analysis_options.yaml b/native_crypto_android/example/analysis_options.yaml
new file mode 100644
index 0000000..61b6c4d
--- /dev/null
+++ b/native_crypto_android/example/analysis_options.yaml
@@ -0,0 +1,29 @@
+# This file configures the analyzer, which statically analyzes Dart code to
+# check for errors, warnings, and lints.
+#
+# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
+# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
+# invoked from the command line by running `flutter analyze`.
+
+# The following line activates a set of recommended lints for Flutter apps,
+# packages, and plugins designed to encourage good coding practices.
+include: package:flutter_lints/flutter.yaml
+
+linter:
+ # The lint rules applied to this project can be customized in the
+ # section below to disable rules from the `package:flutter_lints/flutter.yaml`
+ # included above or to enable additional rules. A list of all available lints
+ # and their documentation is published at
+ # https://dart-lang.github.io/linter/lints/index.html.
+ #
+ # Instead of disabling a lint rule for the entire project in the
+ # section below, it can also be suppressed for a single line of code
+ # or a specific dart file by using the `// ignore: name_of_lint` and
+ # `// ignore_for_file: name_of_lint` syntax on the line or in the file
+ # producing the lint.
+ rules:
+ # avoid_print: false # Uncomment to disable the `avoid_print` rule
+ # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
+
+# Additional information about this file can be found at
+# https://dart.dev/guides/language/analysis-options
diff --git a/native_crypto_android/example/android/.gitignore b/native_crypto_android/example/android/.gitignore
new file mode 100644
index 0000000..6f56801
--- /dev/null
+++ b/native_crypto_android/example/android/.gitignore
@@ -0,0 +1,13 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/native_crypto_android/example/android/app/build.gradle b/native_crypto_android/example/android/app/build.gradle
new file mode 100644
index 0000000..3ec37e2
--- /dev/null
+++ b/native_crypto_android/example/android/app/build.gradle
@@ -0,0 +1,68 @@
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withReader('UTF-8') { reader ->
+ localProperties.load(reader)
+ }
+}
+
+def flutterRoot = localProperties.getProperty('flutter.sdk')
+if (flutterRoot == null) {
+ throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+}
+
+def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
+if (flutterVersionCode == null) {
+ flutterVersionCode = '1'
+}
+
+def flutterVersionName = localProperties.getProperty('flutter.versionName')
+if (flutterVersionName == null) {
+ flutterVersionName = '1.0'
+}
+
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
+android {
+ compileSdkVersion flutter.compileSdkVersion
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId "fr.pointcheval.native_crypto_android_example"
+ minSdkVersion 26
+ targetSdkVersion flutter.targetSdkVersion
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig signingConfigs.debug
+ }
+ }
+}
+
+flutter {
+ source '../..'
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+}
diff --git a/native_crypto_android/example/android/app/src/debug/AndroidManifest.xml b/native_crypto_android/example/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 0000000..758ae3c
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/main/AndroidManifest.xml b/native_crypto_android/example/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..4d48fcc
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/main/kotlin/fr/pointcheval/native_crypto_android_example/MainActivity.kt b/native_crypto_android/example/android/app/src/main/kotlin/fr/pointcheval/native_crypto_android_example/MainActivity.kt
new file mode 100644
index 0000000..0d084ac
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/kotlin/fr/pointcheval/native_crypto_android_example/MainActivity.kt
@@ -0,0 +1,6 @@
+package fr.pointcheval.native_crypto_android_example
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity: FlutterActivity() {
+}
diff --git a/native_crypto_android/example/android/app/src/main/res/drawable-v21/launch_background.xml b/native_crypto_android/example/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/main/res/drawable/launch_background.xml b/native_crypto_android/example/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 0000000..304732f
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/native_crypto_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..db77bb4
Binary files /dev/null and b/native_crypto_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/native_crypto_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/native_crypto_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..17987b7
Binary files /dev/null and b/native_crypto_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/native_crypto_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/native_crypto_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..09d4391
Binary files /dev/null and b/native_crypto_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/native_crypto_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/native_crypto_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..d5f1c8d
Binary files /dev/null and b/native_crypto_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/native_crypto_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/native_crypto_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4d6372e
Binary files /dev/null and b/native_crypto_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/native_crypto_android/example/android/app/src/main/res/values-night/styles.xml b/native_crypto_android/example/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..3db14bb
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/main/res/values/styles.xml b/native_crypto_android/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..d460d1e
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/native_crypto_android/example/android/app/src/profile/AndroidManifest.xml b/native_crypto_android/example/android/app/src/profile/AndroidManifest.xml
new file mode 100644
index 0000000..758ae3c
--- /dev/null
+++ b/native_crypto_android/example/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/native_crypto_android/example/android/build.gradle b/native_crypto_android/example/android/build.gradle
new file mode 100644
index 0000000..24047dc
--- /dev/null
+++ b/native_crypto_android/example/android/build.gradle
@@ -0,0 +1,31 @@
+buildscript {
+ ext.kotlin_version = '1.3.50'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.buildDir = '../build'
+subprojects {
+ project.buildDir = "${rootProject.buildDir}/${project.name}"
+}
+subprojects {
+ project.evaluationDependsOn(':app')
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/native_crypto_android/example/android/gradle.properties b/native_crypto_android/example/android/gradle.properties
new file mode 100644
index 0000000..94adc3a
--- /dev/null
+++ b/native_crypto_android/example/android/gradle.properties
@@ -0,0 +1,3 @@
+org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/native_crypto_android/example/android/gradle/wrapper/gradle-wrapper.properties b/native_crypto_android/example/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..bc6a58a
--- /dev/null
+++ b/native_crypto_android/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Jun 23 08:50:38 CEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/native_crypto_android/example/android/settings.gradle b/native_crypto_android/example/android/settings.gradle
new file mode 100644
index 0000000..44e62bc
--- /dev/null
+++ b/native_crypto_android/example/android/settings.gradle
@@ -0,0 +1,11 @@
+include ':app'
+
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
+
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
+
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/native_crypto_android/example/lib/main.dart b/native_crypto_android/example/lib/main.dart
new file mode 100644
index 0000000..0d1e7a6
--- /dev/null
+++ b/native_crypto_android/example/lib/main.dart
@@ -0,0 +1,75 @@
+import 'dart:typed_data';
+
+import 'package:flutter/material.dart';
+import 'dart:async';
+
+import 'package:flutter/services.dart';
+import 'package:native_crypto_platform_interface/native_crypto_platform_interface.dart';
+
+void main() {
+ runApp(const MyApp());
+}
+
+class MyApp extends StatefulWidget {
+ const MyApp({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _MyAppState();
+}
+
+class _MyAppState extends State {
+ String _platformVersion = 'Unknown';
+
+ @override
+ void initState() {
+ super.initState();
+ initPlatformState();
+ }
+
+ // Platform messages are asynchronous, so we initialize in an async method.
+ Future initPlatformState() async {
+ NativeCryptoPlatform _nativeCryptoPlatform = NativeCryptoPlatform.instance;
+ String platformVersion;
+ // Platform messages may fail, so we use a try/catch PlatformException.
+ // We also handle the message potentially returning null.
+ Uint8List? sk = await _nativeCryptoPlatform.generateSecretKey(256);
+ print(sk ?? 'null');
+
+ Uint8List? ciphertext = await _nativeCryptoPlatform.encrypt(
+ Uint8List.fromList("abc".codeUnits), sk!, "aes");
+ print(ciphertext ?? 'null');
+
+ Uint8List? plaintext =
+ await _nativeCryptoPlatform.decrypt(ciphertext!, sk, "aes");
+ print(plaintext ?? 'null');
+
+ try {
+ platformVersion = 'Unknown platform version';
+ } on PlatformException {
+ platformVersion = 'Failed to get platform version.';
+ }
+
+ // If the widget was removed from the tree while the asynchronous platform
+ // message was in flight, we want to discard the reply rather than calling
+ // setState to update our non-existent appearance.
+ if (!mounted) return;
+
+ setState(() {
+ _platformVersion = platformVersion;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('Plugin example app'),
+ ),
+ body: Center(
+ child: Text('Running on: $_platformVersion\n'),
+ ),
+ ),
+ );
+ }
+}
diff --git a/native_crypto_android/example/pubspec.lock b/native_crypto_android/example/pubspec.lock
new file mode 100644
index 0000000..ee5a879
--- /dev/null
+++ b/native_crypto_android/example/pubspec.lock
@@ -0,0 +1,182 @@
+# Generated by pub
+# See https://dart.dev/tools/pub/glossary#lockfile
+packages:
+ async:
+ dependency: transitive
+ description:
+ name: async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.8.2"
+ boolean_selector:
+ dependency: transitive
+ description:
+ name: boolean_selector
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
+ characters:
+ dependency: transitive
+ description:
+ name: characters
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.2.0"
+ charcode:
+ dependency: transitive
+ description:
+ name: charcode
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.3.1"
+ clock:
+ dependency: transitive
+ description:
+ name: clock
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
+ collection:
+ dependency: transitive
+ description:
+ name: collection
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.15.0"
+ cupertino_icons:
+ dependency: "direct main"
+ description:
+ name: cupertino_icons
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.4"
+ fake_async:
+ dependency: transitive
+ description:
+ name: fake_async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.2.0"
+ flutter:
+ dependency: "direct main"
+ description: flutter
+ source: sdk
+ version: "0.0.0"
+ flutter_lints:
+ dependency: "direct dev"
+ description:
+ name: flutter_lints
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.4"
+ flutter_test:
+ dependency: "direct dev"
+ description: flutter
+ source: sdk
+ version: "0.0.0"
+ lints:
+ dependency: transitive
+ description:
+ name: lints
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
+ matcher:
+ dependency: transitive
+ description:
+ name: matcher
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.12.11"
+ meta:
+ dependency: transitive
+ description:
+ name: meta
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.7.0"
+ native_crypto_android:
+ dependency: "direct main"
+ description:
+ path: ".."
+ relative: true
+ source: path
+ version: "0.1.0"
+ native_crypto_platform_interface:
+ dependency: "direct main"
+ description:
+ path: "../../native_crypto_platform_interface"
+ relative: true
+ source: path
+ version: "0.0.7"
+ path:
+ dependency: transitive
+ description:
+ name: path
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.8.0"
+ sky_engine:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.99"
+ source_span:
+ dependency: transitive
+ description:
+ name: source_span
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.8.1"
+ stack_trace:
+ dependency: transitive
+ description:
+ name: stack_trace
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.10.0"
+ stream_channel:
+ dependency: transitive
+ description:
+ name: stream_channel
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
+ string_scanner:
+ dependency: transitive
+ description:
+ name: string_scanner
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
+ term_glyph:
+ dependency: transitive
+ description:
+ name: term_glyph
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.2.0"
+ test_api:
+ dependency: transitive
+ description:
+ name: test_api
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.3"
+ typed_data:
+ dependency: transitive
+ description:
+ name: typed_data
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.3.0"
+ vector_math:
+ dependency: transitive
+ description:
+ name: vector_math
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.1"
+sdks:
+ dart: ">=2.15.1 <3.0.0"
+ flutter: ">=2.5.0"
diff --git a/native_crypto_android/example/pubspec.yaml b/native_crypto_android/example/pubspec.yaml
new file mode 100644
index 0000000..3b1d332
--- /dev/null
+++ b/native_crypto_android/example/pubspec.yaml
@@ -0,0 +1,87 @@
+name: native_crypto_android_example
+description: Demonstrates how to use the native_crypto_android plugin.
+
+# The following line prevents the package from being accidentally published to
+# pub.dev using `flutter pub publish`. This is preferred for private packages.
+publish_to: 'none' # Remove this line if you wish to publish to pub.dev
+
+environment:
+ sdk: ">=2.15.1 <3.0.0"
+
+# Dependencies specify other packages that your package needs in order to work.
+# To automatically upgrade your package dependencies to the latest versions
+# consider running `flutter pub upgrade --major-versions`. Alternatively,
+# dependencies can be manually updated by changing the version numbers below to
+# the latest version available on pub.dev. To see which dependencies have newer
+# versions available, run `flutter pub outdated`.
+dependencies:
+ flutter:
+ sdk: flutter
+
+ native_crypto_android:
+ # When depending on this package from a real application you should use:
+ # native_crypto_android: ^x.y.z
+ # See https://dart.dev/tools/pub/dependencies#version-constraints
+ # The example app is bundled with the plugin so we use a path dependency on
+ # the parent directory to use the current plugin's version.
+ path: ../
+
+ native_crypto_platform_interface:
+ path: ../../native_crypto_platform_interface
+
+ # The following adds the Cupertino Icons font to your application.
+ # Use with the CupertinoIcons class for iOS style icons.
+ cupertino_icons: ^1.0.2
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+
+ # The "flutter_lints" package below contains a set of recommended lints to
+ # encourage good coding practices. The lint set provided by the package is
+ # activated in the `analysis_options.yaml` file located at the root of your
+ # package. See that file for information about deactivating specific lint
+ # rules and activating additional ones.
+ flutter_lints: ^1.0.0
+
+# For information on the generic Dart part of this file, see the
+# following page: https://dart.dev/tools/pub/pubspec
+
+# The following section is specific to Flutter.
+flutter:
+
+ # The following line ensures that the Material Icons font is
+ # included with your application, so that you can use the icons in
+ # the material Icons class.
+ uses-material-design: true
+
+ # To add assets to your application, add an assets section, like this:
+ # assets:
+ # - images/a_dot_burr.jpeg
+ # - images/a_dot_ham.jpeg
+
+ # An image asset can refer to one or more resolution-specific "variants", see
+ # https://flutter.dev/assets-and-images/#resolution-aware.
+
+ # For details regarding adding assets from package dependencies, see
+ # https://flutter.dev/assets-and-images/#from-packages
+
+ # To add custom fonts to your application, add a fonts section here,
+ # in this "flutter" section. Each entry in this list should have a
+ # "family" key with the font family name, and a "fonts" key with a
+ # list giving the asset and other descriptors for the font. For
+ # example:
+ # fonts:
+ # - family: Schyler
+ # fonts:
+ # - asset: fonts/Schyler-Regular.ttf
+ # - asset: fonts/Schyler-Italic.ttf
+ # style: italic
+ # - family: Trajan Pro
+ # fonts:
+ # - asset: fonts/TrajanPro.ttf
+ # - asset: fonts/TrajanPro_Bold.ttf
+ # weight: 700
+ #
+ # For details regarding fonts from package dependencies,
+ # see https://flutter.dev/custom-fonts/#from-packages
diff --git a/native_crypto_android/example/test/widget_test.dart b/native_crypto_android/example/test/widget_test.dart
new file mode 100644
index 0000000..e4edd16
--- /dev/null
+++ b/native_crypto_android/example/test/widget_test.dart
@@ -0,0 +1,27 @@
+// This is a basic Flutter widget test.
+//
+// To perform an interaction with a widget in your test, use the WidgetTester
+// utility that Flutter provides. For example, you can send tap and scroll
+// gestures. You can also use WidgetTester to find child widgets in the widget
+// tree, read text, and verify that the values of widget properties are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:native_crypto_android_example/main.dart';
+
+void main() {
+ testWidgets('Verify Platform version', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ await tester.pumpWidget(const MyApp());
+
+ // Verify that platform version is retrieved.
+ expect(
+ find.byWidgetPredicate(
+ (Widget widget) => widget is Text &&
+ widget.data!.startsWith('Running on:'),
+ ),
+ findsOneWidget,
+ );
+ });
+}
diff --git a/native_crypto_android/pubspec.yaml b/native_crypto_android/pubspec.yaml
new file mode 100644
index 0000000..27bdf52
--- /dev/null
+++ b/native_crypto_android/pubspec.yaml
@@ -0,0 +1,23 @@
+name: native_crypto_android
+description: Android implementation of NativeCrypto
+version: 0.1.0
+
+environment:
+ sdk: ">=2.15.1 <3.0.0"
+ flutter: ">=2.5.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+
+flutter:
+ plugin:
+ implements: native_crypto
+ platforms:
+ android:
+ package: fr.pointcheval.native_crypto_android
+ pluginClass: NativeCryptoAndroidPlugin
\ No newline at end of file