├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example └── bloc_encryption │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── voinfo │ │ │ │ │ └── bloc_encryption │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle │ ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h │ ├── lib │ ├── app.dart │ ├── business_logic │ │ ├── app_init_bloc │ │ │ ├── app_init_bloc.dart │ │ │ ├── app_init_event.dart │ │ │ └── app_init_state.dart │ │ ├── encryption_bloc │ │ │ ├── encryption_bloc.dart │ │ │ ├── encryption_event.dart │ │ │ └── encryption_state.dart │ │ └── key_manager_bloc │ │ │ ├── keysmanager_bloc.dart │ │ │ ├── keysmanager_event.dart │ │ │ └── keysmanager_state.dart │ ├── main.dart │ └── presentation │ │ └── screen │ │ ├── encryption_screen.dart │ │ └── home_screen.dart │ ├── pubspec.lock │ └── pubspec.yaml ├── lib └── rsa_encrypt.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.3] - 12/08/2019. 2 | 3 | * Documentation on how to use this package. 4 | 5 | ## [1.0.4] - 06/04/2020. 6 | 7 | * Updating dependencies and updating example app. 8 | 9 | 10 | ## [1.0.5] - 21/10/2020. 11 | 12 | * Updating dependencies, Updating RSA keys header/footer, Changed BitStrength to 2048 (more secure), and added new example with BLoC pattern. 13 | 14 | 15 | ## [2.0.0] - 27/04/2021 16 | 17 | * Updating dependencies, Support for Null-Safety -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Abdelbaki Boukerche 2 | Permission is hereby granted, free of charge, to any person obtaining a copy 3 | of this software and associated documentation files (the "Software"), to deal 4 | in the Software without restriction, including without limitation the rights 5 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is 7 | furnished to do so, subject to the following conditions: 8 | The above copyright notice and this permission notice shall be included in all 9 | copies or substantial portions of the Software. 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This package is no longer maintained by its author! 2 | 3 | 4 | # rsa_encrypt 1.0.5 5 | 6 | 7 | 8 | 9 | 10 | RSA encryption package. 11 | 12 | 13 | 14 | 15 | 16 | ## Getting Started 17 | 18 | 19 | 20 | RSA keys **generator**, String **encryption** and **decryption** and String **signing**. 21 | 22 | 23 | 24 | ## How it works 25 | 26 | 27 | 28 | let say **Alice** want to send a message to **Bob**. a normal messaging solution would be : Alice write the message and send it to Bob the only problem is that the Message will be **transferred** in **PlainText** and every one who **intercept** the message can **read it.** 29 | 30 | 31 | 32 | *This is were RSA comes to play*: 33 | 34 | 35 | 36 | 1. We generate keys( public & private ) for Bob. 37 | 38 | 2. If Alice wanted to send a message to Bob she have to encrypt that message with Bob's public keys. 39 | 40 | 3. Then the encrypted message will be transferred to Bob and only Bob's private key can decrypt that message. 41 | 42 | 43 | 44 | that way no none can decrypt the message except the owner of that specific private key. 45 | 46 | 47 | 48 | ## How to use 49 | 50 | 51 | 52 | in order to use RSA encryption you need to generate *2 key*s a **public key** (used to **encrypt** a text) and a **private key** (used to **decrypt** a text). 53 | 54 | Those are the **functions** and **header** *needed*: 55 | 56 | 57 | import 'package:rsa_encrypt/rsa_encrypt.dart'; 58 | import 'package:pointycastle/api.dart' as crypto; 59 | 60 | //Future to hold our KeyPair 61 | Future futureKeyPair; 62 | 63 | //to store the KeyPair once we get data from our future 64 | crypto.AsymmetricKeyPair keyPair; 65 | 66 | Future> getKeyPair() 67 | { 68 | var helper = RsaKeyHelper(); 69 | return helper.computeRSAKeyPair(helper.getSecureRandom()); 70 | } 71 | 72 | 73 | 74 | 1. Generate **KeyPair** with the function **getKeyPair()** store the returned value in **futureKeyPair**. 75 | 2. Once we get data from the future we can store that data in **keyPair** (Now we have acces to our private and public key). 76 | 3. In order to view our keys as "a string" we need to use two functions **encodePrivateKeyToPemPKCS1(*keyPair.privateKey*)** & **encodePublicKeyToPemPKCS1(*keyPair.publicKey*)**. 77 | 4. In order to **encrypt** and **decrypt** strings you can use two functions 78 | * **encrypt()** : use this function to encrypt a string, pass your **string** as first argument and a **public key** as the second one. **[IMPORTANT]**: this will **return a string** so you should **store the returned** value in a variable. 79 | * **decrypt()** : use this function to decrypt an **encrypted String**, pass your **encrypted String** as first argument and a **private key** as the second. this will also **return a string** dont forget to store it :) . 80 | 81 | **A youtube video will be available soon!** 82 | 83 | 84 | 85 | ## More on RSA 86 | 87 | [The RSA Encryption Algorithm (1 of 2: Computing an Example)](https://www.youtube.com/watch?v=4zahvcJ9glg) 88 | 89 | [The RSA Encryption Algorithm (2 of 2: Generating the Keys)](https://www.youtube.com/watch?v=oOcTVTpUsPQ) 90 | 91 | [How to solve RSA Algorithm Problems?](https://www.geeksforgeeks.org/how-to-solve-rsa-algorithm-problems/) 92 | 93 | 94 | 95 | ----------------- 96 | 97 | depends on [pointycastle](https://pub.dev/packages/pointycastle), [asn1lib](https://pub.dev/packages/asn1lib). 98 | 99 | thanks to [Gonçalo Palma](https://medium.com/flutter-community/asymmetric-key-generation-in-flutter-ad2b912f3309) for his Article. 100 | 101 | 102 | 103 | ------------------ 104 | 105 | For help getting started with Flutter, view our 106 | 107 | 108 | 109 | [online documentation](https://flutter.dev/docs), which offers tutorials, 110 | 111 | 112 | 113 | samples, guidance on mobile development, and a full API reference. 114 | -------------------------------------------------------------------------------- /example/bloc_encryption/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | -------------------------------------------------------------------------------- /example/bloc_encryption/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: d408d302e22179d598f467e11da5dd968dbdc9ec 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/bloc_encryption/README.md: -------------------------------------------------------------------------------- 1 | # bloc_encryption 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.voinfo.bloc_encryption" 37 | minSdkVersion 16 38 | targetSdkVersion 29 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | } 42 | 43 | buildTypes { 44 | release { 45 | // TODO: Add your own signing config for the release build. 46 | // Signing with the debug keys for now, so `flutter run --release` works. 47 | signingConfig signingConfigs.debug 48 | } 49 | } 50 | } 51 | 52 | flutter { 53 | source '../..' 54 | } 55 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/java/com/voinfo/bloc_encryption/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.voinfo.bloc_encryption; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/bloc_encryption/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | FRAMEWORK_SEARCH_PATHS = ( 293 | "$(inherited)", 294 | "$(PROJECT_DIR)/Flutter", 295 | ); 296 | INFOPLIST_FILE = Runner/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | LIBRARY_SEARCH_PATHS = ( 299 | "$(inherited)", 300 | "$(PROJECT_DIR)/Flutter", 301 | ); 302 | PRODUCT_BUNDLE_IDENTIFIER = com.voinfo.blocEncryption; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 305 | SWIFT_VERSION = 5.0; 306 | VERSIONING_SYSTEM = "apple-generic"; 307 | }; 308 | name = Profile; 309 | }; 310 | 97C147031CF9000F007C117D /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_NONNULL = YES; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INFINITE_RECURSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_STRICT_PROTOTYPES = YES; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 339 | COPY_PHASE_STRIP = NO; 340 | DEBUG_INFORMATION_FORMAT = dwarf; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | ENABLE_TESTABILITY = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_DYNAMIC_NO_PIC = NO; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | GCC_PREPROCESSOR_DEFINITIONS = ( 348 | "DEBUG=1", 349 | "$(inherited)", 350 | ); 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 358 | MTL_ENABLE_DEBUG_INFO = YES; 359 | ONLY_ACTIVE_ARCH = YES; 360 | SDKROOT = iphoneos; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | }; 363 | name = Debug; 364 | }; 365 | 97C147041CF9000F007C117D /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ALWAYS_SEARCH_USER_PATHS = NO; 369 | CLANG_ANALYZER_NONNULL = YES; 370 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 371 | CLANG_CXX_LIBRARY = "libc++"; 372 | CLANG_ENABLE_MODULES = YES; 373 | CLANG_ENABLE_OBJC_ARC = YES; 374 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 375 | CLANG_WARN_BOOL_CONVERSION = YES; 376 | CLANG_WARN_COMMA = YES; 377 | CLANG_WARN_CONSTANT_CONVERSION = YES; 378 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 379 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 380 | CLANG_WARN_EMPTY_BODY = YES; 381 | CLANG_WARN_ENUM_CONVERSION = YES; 382 | CLANG_WARN_INFINITE_RECURSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 385 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 386 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 389 | CLANG_WARN_STRICT_PROTOTYPES = YES; 390 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 396 | ENABLE_NS_ASSERTIONS = NO; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 407 | MTL_ENABLE_DEBUG_INFO = NO; 408 | SDKROOT = iphoneos; 409 | SUPPORTED_PLATFORMS = iphoneos; 410 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 411 | TARGETED_DEVICE_FAMILY = "1,2"; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | 97C147061CF9000F007C117D /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | CLANG_ENABLE_MODULES = YES; 422 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 423 | ENABLE_BITCODE = NO; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(inherited)", 426 | "$(PROJECT_DIR)/Flutter", 427 | ); 428 | INFOPLIST_FILE = Runner/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | LIBRARY_SEARCH_PATHS = ( 431 | "$(inherited)", 432 | "$(PROJECT_DIR)/Flutter", 433 | ); 434 | PRODUCT_BUNDLE_IDENTIFIER = com.voinfo.blocEncryption; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 437 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 438 | SWIFT_VERSION = 5.0; 439 | VERSIONING_SYSTEM = "apple-generic"; 440 | }; 441 | name = Debug; 442 | }; 443 | 97C147071CF9000F007C117D /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CLANG_ENABLE_MODULES = YES; 449 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 450 | ENABLE_BITCODE = NO; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | INFOPLIST_FILE = Runner/Info.plist; 456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 457 | LIBRARY_SEARCH_PATHS = ( 458 | "$(inherited)", 459 | "$(PROJECT_DIR)/Flutter", 460 | ); 461 | PRODUCT_BUNDLE_IDENTIFIER = com.voinfo.blocEncryption; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 464 | SWIFT_VERSION = 5.0; 465 | VERSIONING_SYSTEM = "apple-generic"; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 97C147031CF9000F007C117D /* Debug */, 476 | 97C147041CF9000F007C117D /* Release */, 477 | 249021D3217E4FDB00AE95B9 /* Profile */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 97C147061CF9000F007C117D /* Debug */, 486 | 97C147071CF9000F007C117D /* Release */, 487 | 249021D4217E4FDB00AE95B9 /* Profile */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullptr-31/rsa_encrypt/8933e2406e38e62e1d4d95dbcd2836a523ae1707/example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | bloc_encryption 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/bloc_encryption/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_encryption/business_logic/app_init_bloc/app_init_bloc.dart'; 2 | import 'package:bloc_encryption/presentation/screen/encryption_screen.dart'; 3 | import 'package:bloc_encryption/presentation/screen/home_screen.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | import 'presentation/screen/home_screen.dart'; 8 | 9 | class MyApp extends StatefulWidget { 10 | @override 11 | _MyAppState createState() => _MyAppState(); 12 | } 13 | 14 | class _MyAppState extends State { 15 | final AppInitBloc _appInitBloc = AppInitBloc(); 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | } 21 | 22 | @override 23 | void dispose() { 24 | _appInitBloc.close(); 25 | super.dispose(); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return BlocProvider( 31 | create: (BuildContext context) => _appInitBloc, 32 | child: MaterialApp( 33 | title: 'RSAEncrypt Demot', 34 | theme: ThemeData( 35 | primarySwatch: Colors.blue, 36 | visualDensity: VisualDensity.adaptivePlatformDensity, 37 | ), 38 | home: BlocBuilder( 39 | builder: (context, state) { 40 | if (state is InitialState) { 41 | return HomeScreen(); 42 | } 43 | if (state is KeyGeneration) { 44 | return Scaffold( 45 | body: Center( 46 | child: CircularProgressIndicator(), 47 | ), 48 | ); 49 | } 50 | if (state is KeysGenerated) { 51 | return EncryptionScreen(asymmetricKeyPair: state.keyPair); 52 | } 53 | return HomeScreen(); 54 | }, 55 | ), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/app_init_bloc/app_init_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | import 'package:meta/meta.dart'; 6 | import 'package:pointycastle/api.dart'; 7 | import 'package:rsa_encrypt/rsa_encrypt.dart'; 8 | 9 | part 'app_init_event.dart'; 10 | part 'app_init_state.dart'; 11 | 12 | class AppInitBloc extends Bloc { 13 | AppInitBloc() : super(InitialState()); 14 | 15 | @override 16 | Stream mapEventToState( 17 | AppInitEvent event, 18 | ) async* { 19 | if (event is AppStarted) { 20 | yield InitialState(); 21 | } 22 | if (event is GenerateKeys) { 23 | yield* _mapGenerateKeysToState(); 24 | } 25 | } 26 | 27 | Stream _mapGenerateKeysToState() async* { 28 | yield KeyGeneration(); 29 | var _rsaKeyHelper = RsaKeyHelper(); 30 | final AsymmetricKeyPair _keyPair = 31 | await _rsaKeyHelper.computeRSAKeyPair(_rsaKeyHelper.getSecureRandom()); 32 | yield KeysGenerated(_keyPair); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/app_init_bloc/app_init_event.dart: -------------------------------------------------------------------------------- 1 | part of 'app_init_bloc.dart'; 2 | 3 | @immutable 4 | abstract class AppInitEvent extends Equatable {} 5 | 6 | class AppStarted extends AppInitEvent { 7 | List get props => []; 8 | } 9 | 10 | class GenerateKeys extends AppInitEvent { 11 | @override 12 | List get props => []; 13 | } 14 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/app_init_bloc/app_init_state.dart: -------------------------------------------------------------------------------- 1 | part of 'app_init_bloc.dart'; 2 | 3 | @immutable 4 | abstract class AppInitState extends Equatable {} 5 | 6 | class InitialState extends AppInitState { 7 | @override 8 | List get props => []; 9 | } 10 | 11 | class KeyGeneration extends AppInitState { 12 | @override 13 | List get props => []; 14 | } 15 | 16 | class KeysGenerated extends AppInitState { 17 | final AsymmetricKeyPair _asymmetricKeyPair; 18 | 19 | AsymmetricKeyPair get keyPair => _asymmetricKeyPair; 20 | 21 | KeysGenerated(this._asymmetricKeyPair); 22 | 23 | @override 24 | List get props => [_asymmetricKeyPair]; 25 | } 26 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/encryption_bloc/encryption_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | import 'package:meta/meta.dart'; 6 | import 'package:pointycastle/export.dart'; 7 | import 'package:rsa_encrypt/rsa_encrypt.dart'; 8 | 9 | part 'encryption_event.dart'; 10 | part 'encryption_state.dart'; 11 | 12 | class EncryptionBloc extends Bloc { 13 | EncryptionBloc() : super(EncryptionInitial()); 14 | 15 | @override 16 | Stream mapEventToState( 17 | EncryptionEvent event, 18 | ) async* { 19 | if (event is EncryptString) { 20 | yield* _mapEncryptStringToState(event); 21 | } else if (event is DecryptString) { 22 | yield* _mapDecryptStringToState(event); 23 | } 24 | } 25 | 26 | Stream _mapEncryptStringToState(EncryptString event) async* { 27 | yield Loading(); 28 | final String _encryptedString = encrypt(event.text, event.publicKey); 29 | yield EncryptionCompleted(_encryptedString); 30 | } 31 | 32 | Stream _mapDecryptStringToState(DecryptString event) async* { 33 | yield Loading(); 34 | final String _decryptedString = 35 | decrypt(event.encryptedString, event.privateKey); 36 | yield DecryptionCompleted(_decryptedString); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/encryption_bloc/encryption_event.dart: -------------------------------------------------------------------------------- 1 | part of 'encryption_bloc.dart'; 2 | 3 | @immutable 4 | abstract class EncryptionEvent extends Equatable {} 5 | 6 | class EncryptString extends EncryptionEvent { 7 | final RSAPublicKey publicKey; 8 | final String text; 9 | 10 | EncryptString(this.text, this.publicKey); 11 | 12 | @override 13 | List get props => [text, publicKey]; 14 | } 15 | 16 | class DecryptString extends EncryptionEvent { 17 | final RSAPrivateKey privateKey; 18 | final String encryptedString; 19 | 20 | DecryptString(this.encryptedString, this.privateKey); 21 | 22 | @override 23 | List get props => [encryptedString, privateKey]; 24 | } 25 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/encryption_bloc/encryption_state.dart: -------------------------------------------------------------------------------- 1 | part of 'encryption_bloc.dart'; 2 | 3 | @immutable 4 | abstract class EncryptionState extends Equatable {} 5 | 6 | class EncryptionInitial extends EncryptionState { 7 | @override 8 | List get props => []; 9 | } 10 | 11 | class Loading extends EncryptionState { 12 | @override 13 | List get props => []; 14 | } 15 | 16 | class EncryptionCompleted extends EncryptionState { 17 | final String _encryptedString; 18 | 19 | EncryptionCompleted(this._encryptedString); 20 | 21 | String get encryptedString => _encryptedString; 22 | 23 | @override 24 | List get props => [_encryptedString]; 25 | } 26 | 27 | class DecryptionCompleted extends EncryptionState { 28 | final String _decryptedString; 29 | 30 | DecryptionCompleted(this._decryptedString); 31 | 32 | String get decryptedString => _decryptedString; 33 | 34 | @override 35 | List get props => [_decryptedString]; 36 | } 37 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/key_manager_bloc/keysmanager_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | import 'package:meta/meta.dart'; 6 | import 'package:pointycastle/export.dart'; 7 | import 'package:rsa_encrypt/rsa_encrypt.dart'; 8 | 9 | part 'keysmanager_event.dart'; 10 | part 'keysmanager_state.dart'; 11 | 12 | class KeysManagerBloc extends Bloc { 13 | KeysManagerBloc() : super(KeysManagerInitial()); 14 | 15 | final RsaKeyHelper _rsaKeyHelper = RsaKeyHelper(); 16 | 17 | @override 18 | Stream mapEventToState( 19 | KeysManagerEvent event, 20 | ) async* { 21 | if (event is ShowPrivateKey) { 22 | yield* _mapShowPrivateKeyToState(event); 23 | } else if (event is ShowPublicKey) { 24 | yield* _mapShowPublicKeyToState(event); 25 | } 26 | } 27 | 28 | Stream _mapShowPrivateKeyToState( 29 | ShowPrivateKey event) async* { 30 | final String _privateKeyStr = _rsaKeyHelper.encodePrivateKeyToPemPKCS1( 31 | event._asymmetricKeyPair.privateKey as RSAPrivateKey); 32 | yield ShowingPrivateKey(_privateKeyStr); 33 | } 34 | 35 | Stream _mapShowPublicKeyToState( 36 | ShowPublicKey event) async* { 37 | final String _publicKeyStr = _rsaKeyHelper.encodePublicKeyToPemPKCS1( 38 | event._asymmetricKeyPair.publicKey as RSAPublicKey); 39 | yield ShowingPublicKey(_publicKeyStr); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/key_manager_bloc/keysmanager_event.dart: -------------------------------------------------------------------------------- 1 | part of 'keysmanager_bloc.dart'; 2 | 3 | @immutable 4 | abstract class KeysManagerEvent extends Equatable {} 5 | 6 | class ShowPrivateKey extends KeysManagerEvent { 7 | final AsymmetricKeyPair _asymmetricKeyPair; 8 | 9 | ShowPrivateKey(this._asymmetricKeyPair); 10 | 11 | @override 12 | List get props => [_asymmetricKeyPair]; 13 | } 14 | 15 | class ShowPublicKey extends KeysManagerEvent { 16 | final AsymmetricKeyPair _asymmetricKeyPair; 17 | 18 | ShowPublicKey(this._asymmetricKeyPair); 19 | 20 | @override 21 | List get props => [_asymmetricKeyPair]; 22 | } 23 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/business_logic/key_manager_bloc/keysmanager_state.dart: -------------------------------------------------------------------------------- 1 | part of 'keysmanager_bloc.dart'; 2 | 3 | @immutable 4 | abstract class KeysManagerState {} 5 | 6 | class KeysManagerInitial extends KeysManagerState {} 7 | 8 | class ShowingPrivateKey extends KeysManagerState { 9 | final String _privateKey; 10 | 11 | ShowingPrivateKey(this._privateKey); 12 | 13 | String get privateKey => _privateKey; 14 | 15 | @override 16 | List get props => [_privateKey]; 17 | } 18 | 19 | class ShowingPublicKey extends KeysManagerState { 20 | final String _publicKey; 21 | 22 | ShowingPublicKey(this._publicKey); 23 | 24 | String get publicKey => _publicKey; 25 | 26 | @override 27 | List get props => [_publicKey]; 28 | } 29 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'app.dart'; 3 | 4 | void main() { 5 | runApp(MyApp()); 6 | } 7 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/presentation/screen/encryption_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_encryption/business_logic/encryption_bloc/encryption_bloc.dart'; 2 | import 'package:bloc_encryption/business_logic/key_manager_bloc/keysmanager_bloc.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:pointycastle/api.dart'; 6 | import 'package:pointycastle/asymmetric/api.dart'; 7 | 8 | class EncryptionScreen extends StatefulWidget { 9 | final AsymmetricKeyPair _asymmetricKeyPair; 10 | const EncryptionScreen( 11 | {Key? key, required AsymmetricKeyPair asymmetricKeyPair}) 12 | : _asymmetricKeyPair = asymmetricKeyPair, 13 | super(key: key); 14 | 15 | @override 16 | _EncryptionScreenState createState() => _EncryptionScreenState(); 17 | } 18 | 19 | class _EncryptionScreenState extends State { 20 | final EncryptionBloc _encryptionBloc = EncryptionBloc(); 21 | final KeysManagerBloc _keysManagerBloc = KeysManagerBloc(); 22 | 23 | final TextEditingController _textController = TextEditingController(); 24 | String encryptedString = ""; 25 | 26 | @override 27 | void dispose() { 28 | _encryptionBloc.close(); 29 | super.dispose(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return MultiBlocProvider( 35 | providers: [ 36 | BlocProvider( 37 | create: (context) => _encryptionBloc, 38 | ), 39 | BlocProvider( 40 | create: (context) => _keysManagerBloc, 41 | ), 42 | ], 43 | child: Scaffold( 44 | appBar: AppBar( 45 | centerTitle: true, 46 | title: Text("Encryption"), 47 | ), 48 | body: SingleChildScrollView( 49 | child: Column( 50 | children: [ 51 | Row( 52 | mainAxisAlignment: MainAxisAlignment.center, 53 | children: [ 54 | RaisedButton( 55 | child: Text("Private Key"), 56 | onPressed: () { 57 | _keysManagerBloc.add( 58 | ShowPrivateKey(widget._asymmetricKeyPair), 59 | ); 60 | }, 61 | ), 62 | SizedBox(width: 10), 63 | RaisedButton( 64 | child: Text("Public Key"), 65 | onPressed: () { 66 | _keysManagerBloc.add( 67 | ShowPublicKey(widget._asymmetricKeyPair), 68 | ); 69 | }, 70 | ), 71 | ], 72 | ), 73 | Container( 74 | decoration: BoxDecoration( 75 | border: Border.all(), 76 | ), 77 | margin: EdgeInsets.only( 78 | left: 16.0, 79 | right: 16.0, 80 | top: 16.0, 81 | bottom: 16.0, 82 | ), 83 | padding: EdgeInsets.all(12.0), 84 | width: double.infinity, 85 | height: 150, 86 | child: SingleChildScrollView( 87 | scrollDirection: Axis.vertical, 88 | child: BlocBuilder( 89 | builder: (context, state) { 90 | if (state is KeysManagerInitial) { 91 | return Text( 92 | "Show RSA Key Pem Here", 93 | textAlign: TextAlign.center, 94 | ); 95 | } 96 | if (state is ShowingPrivateKey) { 97 | return Text( 98 | state.privateKey, 99 | textAlign: TextAlign.center, 100 | ); 101 | } 102 | if (state is ShowingPublicKey) { 103 | return Text( 104 | state.publicKey, 105 | textAlign: TextAlign.center, 106 | ); 107 | } 108 | return Text( 109 | "Show RSA Key Pem Here", 110 | textAlign: TextAlign.center, 111 | ); 112 | }, 113 | ), 114 | ), 115 | ), 116 | Divider(thickness: 2), 117 | // Encryption 118 | Container( 119 | margin: EdgeInsets.only( 120 | left: 16.0, 121 | right: 16.0, 122 | top: 8.0, 123 | bottom: 8.0, 124 | ), 125 | child: TextField( 126 | controller: _textController, 127 | textAlign: TextAlign.center, 128 | decoration: InputDecoration(hintText: "String to encrypt"), 129 | ), 130 | ), 131 | RaisedButton( 132 | child: Text("Encrypt"), 133 | onPressed: () { 134 | _encryptionBloc.add( 135 | EncryptString( 136 | _textController.text.trim(), 137 | widget._asymmetricKeyPair.publicKey as RSAPublicKey, 138 | ), 139 | ); 140 | }, 141 | ), 142 | // Decryption 143 | Container( 144 | decoration: BoxDecoration( 145 | border: Border.all(), 146 | ), 147 | margin: EdgeInsets.only( 148 | left: 16.0, 149 | right: 16.0, 150 | top: 16.0, 151 | bottom: 16.0, 152 | ), 153 | padding: EdgeInsets.all(12.0), 154 | width: double.infinity, 155 | height: 75, 156 | child: SingleChildScrollView( 157 | scrollDirection: Axis.vertical, 158 | child: BlocBuilder( 159 | buildWhen: (previous, current) => previous != current, 160 | builder: (context, state) { 161 | if (state is EncryptionCompleted) { 162 | encryptedString = state.encryptedString; 163 | return Text( 164 | state.encryptedString, 165 | textAlign: TextAlign.center, 166 | ); 167 | } 168 | if (state is DecryptionCompleted) { 169 | return Text( 170 | state.decryptedString, 171 | textAlign: TextAlign.center, 172 | ); 173 | } 174 | return Text( 175 | "Show Encrypted String Here", 176 | textAlign: TextAlign.center, 177 | ); 178 | }, 179 | ), 180 | ), 181 | ), 182 | RaisedButton( 183 | child: Text("Decrypt"), 184 | onPressed: () { 185 | _encryptionBloc.add( 186 | DecryptString( 187 | encryptedString, 188 | widget._asymmetricKeyPair.privateKey as RSAPrivateKey, 189 | ), 190 | ); 191 | }, 192 | ), 193 | ], 194 | ), 195 | ), 196 | ), 197 | ); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /example/bloc_encryption/lib/presentation/screen/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_encryption/business_logic/app_init_bloc/app_init_bloc.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | 5 | class HomeScreen extends StatelessWidget { 6 | const HomeScreen({Key? key}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | appBar: AppBar( 12 | centerTitle: true, 13 | title: Text("RSA Encrypt"), 14 | ), 15 | body: Center( 16 | child: RaisedButton( 17 | onPressed: () { 18 | BlocProvider.of(context).add(GenerateKeys()); 19 | }, 20 | child: Text("Generate Keys"), 21 | ), 22 | ), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/bloc_encryption/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | asn1lib: 5 | dependency: transitive 6 | description: 7 | name: asn1lib 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.0.0" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.5.0" 18 | bloc: 19 | dependency: transitive 20 | description: 21 | name: bloc 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "7.0.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.1.0" 32 | characters: 33 | dependency: transitive 34 | description: 35 | name: characters 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.2.0" 46 | clock: 47 | dependency: transitive 48 | description: 49 | name: clock 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.1.0" 53 | collection: 54 | dependency: transitive 55 | description: 56 | name: collection 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.15.0" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.0.2" 67 | equatable: 68 | dependency: "direct main" 69 | description: 70 | name: equatable 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "2.0.0" 74 | fading_edge_scrollview: 75 | dependency: transitive 76 | description: 77 | name: fading_edge_scrollview 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "2.0.0" 81 | fake_async: 82 | dependency: transitive 83 | description: 84 | name: fake_async 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.2.0" 88 | flutter: 89 | dependency: "direct main" 90 | description: flutter 91 | source: sdk 92 | version: "0.0.0" 93 | flutter_bloc: 94 | dependency: "direct main" 95 | description: 96 | name: flutter_bloc 97 | url: "https://pub.dartlang.org" 98 | source: hosted 99 | version: "7.0.0" 100 | flutter_test: 101 | dependency: "direct dev" 102 | description: flutter 103 | source: sdk 104 | version: "0.0.0" 105 | marquee: 106 | dependency: "direct main" 107 | description: 108 | name: marquee 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.1.0" 112 | matcher: 113 | dependency: transitive 114 | description: 115 | name: matcher 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "0.12.10" 119 | meta: 120 | dependency: transitive 121 | description: 122 | name: meta 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.3.0" 126 | nested: 127 | dependency: transitive 128 | description: 129 | name: nested 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.0.0" 133 | path: 134 | dependency: transitive 135 | description: 136 | name: path 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "1.8.0" 140 | pointycastle: 141 | dependency: "direct main" 142 | description: 143 | name: pointycastle 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "3.0.1" 147 | provider: 148 | dependency: transitive 149 | description: 150 | name: provider 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "5.0.0" 154 | rsa_encrypt: 155 | dependency: "direct main" 156 | description: 157 | path: "../.." 158 | relative: true 159 | source: path 160 | version: "1.0.5" 161 | sky_engine: 162 | dependency: transitive 163 | description: flutter 164 | source: sdk 165 | version: "0.0.99" 166 | source_span: 167 | dependency: transitive 168 | description: 169 | name: source_span 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.8.0" 173 | stack_trace: 174 | dependency: transitive 175 | description: 176 | name: stack_trace 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.10.0" 180 | stream_channel: 181 | dependency: transitive 182 | description: 183 | name: stream_channel 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.1.0" 187 | string_scanner: 188 | dependency: transitive 189 | description: 190 | name: string_scanner 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.1.0" 194 | term_glyph: 195 | dependency: transitive 196 | description: 197 | name: term_glyph 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.2.0" 201 | test_api: 202 | dependency: transitive 203 | description: 204 | name: test_api 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "0.2.19" 208 | typed_data: 209 | dependency: transitive 210 | description: 211 | name: typed_data 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "1.3.0" 215 | vector_math: 216 | dependency: transitive 217 | description: 218 | name: vector_math 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "2.1.0" 222 | sdks: 223 | dart: ">=2.12.0 <3.0.0" 224 | flutter: ">=1.16.0" 225 | -------------------------------------------------------------------------------- /example/bloc_encryption/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: bloc_encryption 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | rsa_encrypt: 27 | path: ../../ 28 | cupertino_icons: ^1.0.2 29 | equatable: ^2.0.0 30 | flutter_bloc: ^7.0.0 31 | marquee: ^2.1.0 32 | pointycastle: ^3.0.1 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | 38 | # For information on the generic Dart part of this file, see the 39 | # following page: https://dart.dev/tools/pub/pubspec 40 | # The following section is specific to Flutter. 41 | flutter: 42 | 43 | # The following line ensures that the Material Icons font is 44 | # included with your application, so that you can use the icons in 45 | # the material Icons class. 46 | uses-material-design: true 47 | # To add assets to your application, add an assets section, like this: 48 | # assets: 49 | # - images/a_dot_burr.jpeg 50 | # - images/a_dot_ham.jpeg 51 | # An image asset can refer to one or more resolution-specific "variants", see 52 | # https://flutter.dev/assets-and-images/#resolution-aware. 53 | # For details regarding adding assets from package dependencies, see 54 | # https://flutter.dev/assets-and-images/#from-packages 55 | # To add custom fonts to your application, add a fonts section here, 56 | # in this "flutter" section. Each entry in this list should have a 57 | # "family" key with the font family name, and a "fonts" key with a 58 | # list giving the asset and other descriptors for the font. For 59 | # example: 60 | # fonts: 61 | # - family: Schyler 62 | # fonts: 63 | # - asset: fonts/Schyler-Regular.ttf 64 | # - asset: fonts/Schyler-Italic.ttf 65 | # style: italic 66 | # - family: Trajan Pro 67 | # fonts: 68 | # - asset: fonts/TrajanPro.ttf 69 | # - asset: fonts/TrajanPro_Bold.ttf 70 | # weight: 700 71 | # 72 | # For details regarding fonts from package dependencies, 73 | # see https://flutter.dev/custom-fonts/#from-packages 74 | -------------------------------------------------------------------------------- /lib/rsa_encrypt.dart: -------------------------------------------------------------------------------- 1 | library rsa_encrypt; 2 | 3 | import 'dart:convert'; 4 | import 'dart:math'; 5 | import 'dart:typed_data'; 6 | 7 | import "package:asn1lib/asn1lib.dart"; 8 | import 'package:flutter/foundation.dart'; 9 | import 'package:pointycastle/export.dart'; 10 | 11 | /// Helper class to handle RSA key generation, encoding, decoding, encrypting 12 | /// and decrypting strings 13 | 14 | class RsaKeyHelper { 15 | /// Generate a [PublicKey] and [PrivateKey] pair 16 | /// 17 | /// Returns a [AsymmetricKeyPair] based on the [RSAKeyGenerator] with custom parameters, 18 | /// including a [SecureRandom] 19 | Future> computeRSAKeyPair( 20 | SecureRandom secureRandom) async { 21 | return await compute(getRsaKeyPair, secureRandom); 22 | } 23 | 24 | /// Generates a [SecureRandom] to use in computing RSA key pair 25 | /// 26 | /// Returns [FortunaRandom] to be used in the [AsymmetricKeyPair] generation 27 | SecureRandom getSecureRandom() { 28 | var secureRandom = FortunaRandom(); 29 | var random = Random.secure(); 30 | List seeds = []; 31 | for (int i = 0; i < 32; i++) { 32 | seeds.add(random.nextInt(255)); 33 | } 34 | secureRandom.seed(new KeyParameter(new Uint8List.fromList(seeds))); 35 | return secureRandom; 36 | } 37 | 38 | /// Decode Public key from PEM Format 39 | /// 40 | /// Given a base64 encoded PEM [String] with correct headers and footers, return a 41 | /// [RSAPublicKey] 42 | /// 43 | /// *PKCS1* 44 | /// RSAPublicKey ::= SEQUENCE { 45 | /// modulus INTEGER, -- n 46 | /// publicExponent INTEGER -- e 47 | /// } 48 | /// 49 | /// *PKCS8* 50 | /// PublicKeyInfo ::= SEQUENCE { 51 | /// algorithm AlgorithmIdentifier, 52 | /// PublicKey BIT STRING 53 | /// } 54 | /// 55 | /// AlgorithmIdentifier ::= SEQUENCE { 56 | /// algorithm OBJECT IDENTIFIER, 57 | /// parameters ANY DEFINED BY algorithm OPTIONAL 58 | /// } 59 | RSAPublicKey parsePublicKeyFromPem(pemString) { 60 | List publicKeyDER = decodePEM(pemString); 61 | ASN1Parser asn1Parser = new ASN1Parser(publicKeyDER as Uint8List); 62 | ASN1Sequence topLevelSeq = asn1Parser.nextObject() as ASN1Sequence; 63 | 64 | var modulus, exponent; 65 | // Depending on the first element type, we either have PKCS1 or 2 66 | if (topLevelSeq.elements[0].runtimeType == ASN1Integer) { 67 | modulus = topLevelSeq.elements[0] as ASN1Integer; 68 | exponent = topLevelSeq.elements[1] as ASN1Integer; 69 | } else { 70 | var publicKeyBitString = topLevelSeq.elements[1]; 71 | 72 | var publicKeyAsn = new ASN1Parser(publicKeyBitString.contentBytes()!); 73 | ASN1Sequence publicKeySeq = publicKeyAsn.nextObject() as ASN1Sequence; 74 | modulus = publicKeySeq.elements[0] as ASN1Integer; 75 | exponent = publicKeySeq.elements[1] as ASN1Integer; 76 | } 77 | 78 | RSAPublicKey rsaPublicKey = 79 | RSAPublicKey(modulus.valueAsBigInteger, exponent.valueAsBigInteger); 80 | 81 | return rsaPublicKey; 82 | } 83 | 84 | /// Sign plain text with Private Key 85 | /// 86 | /// Given a plain text [String] and a [RSAPrivateKey], decrypt the text using 87 | /// a [RSAEngine] cipher 88 | String sign(String plainText, RSAPrivateKey privateKey) { 89 | var signer = RSASigner(SHA256Digest(), "0609608648016503040201"); 90 | signer.init(true, PrivateKeyParameter(privateKey)); 91 | return base64Encode( 92 | signer.generateSignature(createUint8ListFromString(plainText)).bytes); 93 | } 94 | 95 | /// Creates a [Uint8List] from a string to be signed 96 | Uint8List createUint8ListFromString(String s) { 97 | var codec = Utf8Codec(allowMalformed: true); 98 | return Uint8List.fromList(codec.encode(s)); 99 | } 100 | 101 | /// Decode Private key from PEM Format 102 | /// 103 | /// Given a base64 encoded PEM [String] with correct headers and footers, return a 104 | /// [RSAPrivateKey] 105 | RSAPrivateKey parsePrivateKeyFromPem(pemString) { 106 | List privateKeyDER = decodePEM(pemString); 107 | var asn1Parser = new ASN1Parser(privateKeyDER as Uint8List); 108 | var topLevelSeq = asn1Parser.nextObject() as ASN1Sequence; 109 | 110 | var modulus, privateExponent, p, q; 111 | //Use either PKCS1 or PKCS8 depending on the number of ELEMENTS 112 | if (topLevelSeq.elements.length == 3) { 113 | var privateKey = topLevelSeq.elements[2]; 114 | 115 | asn1Parser = new ASN1Parser(privateKey.contentBytes()!); 116 | var pkSeq = asn1Parser.nextObject() as ASN1Sequence; 117 | 118 | modulus = pkSeq.elements[1] as ASN1Integer; 119 | privateExponent = pkSeq.elements[3] as ASN1Integer; 120 | p = pkSeq.elements[4] as ASN1Integer; 121 | q = pkSeq.elements[5] as ASN1Integer; 122 | } else { 123 | modulus = topLevelSeq.elements[1] as ASN1Integer; 124 | privateExponent = topLevelSeq.elements[3] as ASN1Integer; 125 | p = topLevelSeq.elements[4] as ASN1Integer; 126 | q = topLevelSeq.elements[5] as ASN1Integer; 127 | } 128 | 129 | RSAPrivateKey rsaPrivateKey = RSAPrivateKey( 130 | modulus.valueAsBigInteger, 131 | privateExponent.valueAsBigInteger, 132 | p.valueAsBigInteger, 133 | q.valueAsBigInteger); 134 | 135 | return rsaPrivateKey; 136 | } 137 | 138 | List decodePEM(String pem) { 139 | return base64.decode(removePemHeaderAndFooter(pem)); 140 | } 141 | 142 | String removePemHeaderAndFooter(String pem) { 143 | var startsWith = [ 144 | "-----BEGIN PUBLIC KEY-----", 145 | "-----BEGIN RSA PRIVATE KEY-----", 146 | "-----BEGIN RSA PUBLIC KEY-----", 147 | "-----BEGIN PRIVATE KEY-----", 148 | "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nVersion: React-Native-OpenPGP.js 0.1\r\nComment: http://openpgpjs.org\r\n\r\n", 149 | "-----BEGIN PGP PRIVATE KEY BLOCK-----\r\nVersion: React-Native-OpenPGP.js 0.1\r\nComment: http://openpgpjs.org\r\n\r\n", 150 | ]; 151 | var endsWith = [ 152 | "-----END PUBLIC KEY-----", 153 | "-----END PRIVATE KEY-----", 154 | "-----END RSA PRIVATE KEY-----", 155 | "-----END RSA PUBLIC KEY-----", 156 | "-----END PGP PUBLIC KEY BLOCK-----", 157 | "-----END PGP PRIVATE KEY BLOCK-----", 158 | ]; 159 | bool isOpenPgp = pem.indexOf('BEGIN PGP') != -1; 160 | 161 | pem = pem.replaceAll(' ', ''); 162 | pem = pem.replaceAll('\n', ''); 163 | pem = pem.replaceAll('\r', ''); 164 | 165 | for (var s in startsWith) { 166 | s = s.replaceAll(' ', ''); 167 | if (pem.startsWith(s)) { 168 | pem = pem.substring(s.length); 169 | } 170 | } 171 | 172 | for (var s in endsWith) { 173 | s = s.replaceAll(' ', ''); 174 | if (pem.endsWith(s)) { 175 | pem = pem.substring(0, pem.length - s.length); 176 | } 177 | } 178 | 179 | if (isOpenPgp) { 180 | var index = pem.indexOf('\r\n'); 181 | pem = pem.substring(0, index); 182 | } 183 | 184 | return pem; 185 | } 186 | 187 | /// Encode Private key to PEM Format 188 | /// 189 | /// Given [RSAPrivateKey] returns a base64 encoded [String] with standard PEM headers and footers 190 | String encodePrivateKeyToPemPKCS1(RSAPrivateKey privateKey) { 191 | var topLevel = new ASN1Sequence(); 192 | 193 | var version = ASN1Integer(BigInt.from(0)); 194 | var modulus = ASN1Integer(privateKey.n!); 195 | var publicExponent = ASN1Integer(privateKey.exponent!); 196 | var privateExponent = ASN1Integer(privateKey.privateExponent!); 197 | var p = ASN1Integer(privateKey.p!); 198 | var q = ASN1Integer(privateKey.q!); 199 | var dP = privateKey.privateExponent! % (privateKey.p! - BigInt.from(1)); 200 | var exp1 = ASN1Integer(dP); 201 | var dQ = privateKey.privateExponent! % (privateKey.q! - BigInt.from(1)); 202 | var exp2 = ASN1Integer(dQ); 203 | var iQ = privateKey.q!.modInverse(privateKey.p!); 204 | var co = ASN1Integer(iQ); 205 | 206 | topLevel.add(version); 207 | topLevel.add(modulus); 208 | topLevel.add(publicExponent); 209 | topLevel.add(privateExponent); 210 | topLevel.add(p); 211 | topLevel.add(q); 212 | topLevel.add(exp1); 213 | topLevel.add(exp2); 214 | topLevel.add(co); 215 | 216 | var dataBase64 = base64.encode(topLevel.encodedBytes); 217 | 218 | return """-----BEGIN RSA PRIVATE KEY-----\r\n$dataBase64\r\n-----END RSA PRIVATE KEY-----"""; 219 | } 220 | 221 | /// Encode Public key to PEM Format 222 | /// 223 | /// Given [RSAPublicKey] returns a base64 encoded [String] with standard PEM headers and footers 224 | String encodePublicKeyToPemPKCS1(RSAPublicKey publicKey) { 225 | var topLevel = new ASN1Sequence(); 226 | 227 | topLevel.add(ASN1Integer(publicKey.modulus!)); 228 | topLevel.add(ASN1Integer(publicKey.exponent!)); 229 | 230 | var dataBase64 = base64.encode(topLevel.encodedBytes); 231 | return """-----BEGIN RSA PUBLIC KEY-----\r\n$dataBase64\r\n-----END RSA PUBLIC KEY-----"""; 232 | } 233 | } 234 | 235 | /// Encrypting String 236 | String encrypt(String plaintext, RSAPublicKey publicKey) { 237 | var cipher = new RSAEngine() 238 | ..init(true, new PublicKeyParameter(publicKey)); 239 | var cipherText = cipher.process(new Uint8List.fromList(plaintext.codeUnits)); 240 | 241 | return new String.fromCharCodes(cipherText); 242 | } 243 | 244 | /// Decrypting String 245 | String decrypt(String ciphertext, RSAPrivateKey privateKey) { 246 | var cipher = new RSAEngine() 247 | ..init(false, new PrivateKeyParameter(privateKey)); 248 | var decrypted = cipher.process(new Uint8List.fromList(ciphertext.codeUnits)); 249 | 250 | return new String.fromCharCodes(decrypted); 251 | } 252 | 253 | /// Generate a [PublicKey] and [PrivateKey] pair 254 | /// 255 | /// Returns a [AsymmetricKeyPair] based on the [RSAKeyGenerator] with custom parameters, 256 | /// including a [SecureRandom] 257 | AsymmetricKeyPair getRsaKeyPair( 258 | SecureRandom secureRandom) { 259 | /// Set BitStrength to [1024, 2048 or 4096] 260 | var rsapars = new RSAKeyGeneratorParameters(BigInt.from(65537), 2048, 5); 261 | var params = new ParametersWithRandom(rsapars, secureRandom); 262 | var keyGenerator = new RSAKeyGenerator(); 263 | keyGenerator.init(params); 264 | return keyGenerator.generateKeyPair(); 265 | } 266 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | asn1lib: 5 | dependency: "direct main" 6 | description: 7 | name: asn1lib 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.0.0" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.5.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.0" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.15.0" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.10" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.3.0" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.8.0" 91 | pointycastle: 92 | dependency: "direct main" 93 | description: 94 | name: pointycastle 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "3.0.1" 98 | sky_engine: 99 | dependency: transitive 100 | description: flutter 101 | source: sdk 102 | version: "0.0.99" 103 | source_span: 104 | dependency: transitive 105 | description: 106 | name: source_span 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.8.0" 110 | stack_trace: 111 | dependency: transitive 112 | description: 113 | name: stack_trace 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.10.0" 117 | stream_channel: 118 | dependency: transitive 119 | description: 120 | name: stream_channel 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.1.0" 124 | string_scanner: 125 | dependency: transitive 126 | description: 127 | name: string_scanner 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.0" 131 | term_glyph: 132 | dependency: transitive 133 | description: 134 | name: term_glyph 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.2.0" 138 | test_api: 139 | dependency: transitive 140 | description: 141 | name: test_api 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.2.19" 145 | typed_data: 146 | dependency: transitive 147 | description: 148 | name: typed_data 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.3.0" 152 | vector_math: 153 | dependency: transitive 154 | description: 155 | name: vector_math 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.0" 159 | sdks: 160 | dart: ">=2.12.0 <3.0.0" 161 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rsa_encrypt 2 | description: Enable you to quickly implement rsa encryption in your flutter app, 3 | it covers everything from Generating key pairs, encrypt and decrypting 4 | strings. 5 | version: 2.0.0 6 | homepage: https://github.com/AbdelbakiBoukerche/rsa_encrypt 7 | 8 | environment: 9 | sdk: ">=2.12.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | asn1lib: ^1.0.0 15 | pointycastle: ^3.0.1 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | 21 | flutter: null 22 | 23 | # To add assets to your package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | --------------------------------------------------------------------------------