├── .github ├── FUNDING.yml └── workflows │ └── dart.yml ├── .gitignore ├── LICENSE ├── README.md ├── cryptography ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── dart_test.yaml ├── example │ ├── lib │ │ └── example.dart │ └── pubspec.yaml ├── lib │ ├── browser.dart │ ├── cryptography.dart │ ├── dart.dart │ ├── helpers.dart │ └── src │ │ ├── _internal │ │ ├── big_int.dart │ │ ├── bytes.dart │ │ ├── hex.dart │ │ └── rotate.dart │ │ ├── browser │ │ ├── _javascript_bindings.dart │ │ ├── aes_cbc.dart │ │ ├── aes_ctr.dart │ │ ├── aes_gcm.dart │ │ ├── browser_cryptography.dart │ │ ├── browser_cryptography_when_not_browser.dart │ │ ├── browser_ec_key_pair.dart │ │ ├── browser_secret_key.dart │ │ ├── ecdh.dart │ │ ├── ecdsa.dart │ │ ├── hash.dart │ │ ├── hkdf.dart │ │ ├── hmac.dart │ │ ├── pbkdf2.dart │ │ ├── rsa_pss.dart │ │ └── rsa_ssa_pkcs1v15.dart │ │ ├── cryptography │ │ ├── _cupertino_der.dart │ │ ├── algorithms.dart │ │ ├── cipher.dart │ │ ├── cipher_state.dart │ │ ├── cipher_wand.dart │ │ ├── cryptography.dart │ │ ├── ec_key_pair.dart │ │ ├── ec_public_key.dart │ │ ├── hash.dart │ │ ├── hash_algorithm.dart │ │ ├── kdf_algorithm.dart │ │ ├── key_exchange_algorithm.dart │ │ ├── key_exchange_wand.dart │ │ ├── key_pair.dart │ │ ├── key_pair_type.dart │ │ ├── mac.dart │ │ ├── mac_algorithm.dart │ │ ├── padding_algorithm.dart │ │ ├── rsa_key_pair.dart │ │ ├── rsa_public_key.dart │ │ ├── secret_box.dart │ │ ├── secret_key.dart │ │ ├── secret_key_type.dart │ │ ├── secure_random.dart │ │ ├── sensitive_bytes.dart │ │ ├── signature.dart │ │ ├── signature_algorithm.dart │ │ ├── signature_wand.dart │ │ ├── simple_key_pair.dart │ │ ├── simple_public_key.dart │ │ └── wand.dart │ │ ├── dart │ │ ├── _helpers.dart │ │ ├── aes_cbc.dart │ │ ├── aes_ctr.dart │ │ ├── aes_gcm.dart │ │ ├── aes_impl.dart │ │ ├── aes_impl_constants.dart │ │ ├── argon2.dart │ │ ├── argon2_impl_browser.dart │ │ ├── argon2_impl_vm.dart │ │ ├── blake2b.dart │ │ ├── blake2b_impl_browser.dart │ │ ├── blake2b_impl_vm.dart │ │ ├── blake2s.dart │ │ ├── chacha20.dart │ │ ├── chacha20_poly1305_aead_mac_algorithm.dart │ │ ├── cryptography.dart │ │ ├── dart_cipher.dart │ │ ├── dart_hash_algorithm.dart │ │ ├── dart_key_exchange_algorithm.dart │ │ ├── dart_mac_algorithm.dart │ │ ├── dart_signature_algorithm.dart │ │ ├── ecdh.dart │ │ ├── ecdsa.dart │ │ ├── ed25519.dart │ │ ├── ed25519_impl.dart │ │ ├── hchacha20.dart │ │ ├── hkdf.dart │ │ ├── hmac.dart │ │ ├── pbkdf2.dart │ │ ├── poly1305.dart │ │ ├── rsa_pss.dart │ │ ├── rsa_ssa_pkcs1v15.dart │ │ ├── sha1.dart │ │ ├── sha256.dart │ │ ├── sha512.dart │ │ ├── x25519.dart │ │ ├── x25519_impl.dart │ │ └── xchacha20.dart │ │ ├── helpers │ │ ├── constant_time_equality.dart │ │ ├── delegating_classes.dart │ │ ├── math.dart │ │ ├── random_bytes.dart │ │ ├── random_bytes_impl_browser.dart │ │ └── random_bytes_impl_default.dart │ │ └── utils.dart ├── pubspec.yaml └── test │ ├── algorithms │ ├── aes_cbc_test.dart │ ├── aes_ctr_test.dart │ ├── aes_gcm_test.dart │ ├── aes_impl_test.dart │ ├── argon2_test.dart │ ├── blake2b_test.dart │ ├── blake2s_test.dart │ ├── chacha20_poly1305_aead_test.dart │ ├── chacha20_test.dart │ ├── ed25519_impl_test.dart │ ├── generated │ │ └── generate.go │ ├── hchacha20_test.dart │ ├── hmac_test.dart │ ├── pbkdf2_test.dart │ ├── poly1305_test.dart │ ├── rsa_pss_test.dart │ ├── rsa_ssa_pkcs1v15_test.dart │ ├── sha256_test.dart │ ├── sha2_and_sha1_test.dart │ └── xchacha20_test.dart │ ├── benchmark │ ├── argon2.dart │ ├── benchmark_helpers.dart │ ├── cipher.dart │ ├── cipher_with_gigabytes_of_input.dart │ ├── hash.dart │ ├── key_exchange.dart │ ├── pkbdf.dart │ ├── random.dart │ └── signature.dart │ ├── browser_cryptography_test.dart │ ├── cryptography_with_seeded_random_test.dart │ ├── ec_key_pair_extraction_test.dart │ ├── ec_key_pair_test.dart │ ├── hash_test.dart │ ├── mac_test.dart │ ├── padding_algorithm_test.dart │ ├── rsa_key_pair_test.dart │ ├── secret_box_test.dart │ ├── secret_key_test.dart │ ├── secure_random_test.dart │ ├── signature_test.dart │ ├── simple_key_pair_test.dart │ ├── simple_public_key_test.dart │ └── utils_test.dart ├── cryptography_flutter ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── dev │ │ └── dint │ │ └── cryptography_flutter │ │ └── CryptographyFlutterPlugin.kt ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── 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-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── 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 │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── 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 │ │ └── main.dart │ ├── linux │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ │ ├── CMakeLists.txt │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugin_registrant.h │ │ │ └── generated_plugins.cmake │ │ ├── main.cc │ │ ├── my_application.cc │ │ └── my_application.h │ ├── macos │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ │ ├── DebugProfile.entitlements │ │ │ ├── Info.plist │ │ │ ├── MainFlutterWindow.swift │ │ │ └── Release.entitlements │ ├── pubspec.yaml │ ├── web │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ └── manifest.json │ └── windows │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ │ └── runner │ │ ├── CMakeLists.txt │ │ ├── Runner.rc │ │ ├── flutter_window.cpp │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── resource.h │ │ ├── resources │ │ └── app_icon.ico │ │ ├── runner.exe.manifest │ │ ├── utils.cpp │ │ ├── utils.h │ │ ├── win32_window.cpp │ │ └── win32_window.h ├── ios │ ├── .gitignore │ ├── Classes │ │ └── CryptographyFlutterPlugin.swift │ └── cryptography_flutter.podspec ├── lib │ ├── android.dart │ ├── cryptography_flutter.dart │ └── src │ │ ├── _flutter_cryptography_implementation.dart │ │ ├── _internal.dart │ │ ├── _internal_impl_browser.dart │ │ ├── _internal_impl_non_browser.dart │ │ ├── background │ │ ├── background_aes_gcm.dart │ │ ├── background_chacha20.dart │ │ ├── background_cipher.dart │ │ └── background_pbkdf2.dart │ │ ├── cryptography_channel_policy.dart │ │ ├── cryptography_channel_queue.dart │ │ ├── cryptography_unsupported_error.dart │ │ ├── flutter │ │ ├── flutter_aes_gcm.dart │ │ ├── flutter_chacha20.dart │ │ ├── flutter_cipher.dart │ │ ├── flutter_ecdh.dart │ │ ├── flutter_ecdsa.dart │ │ ├── flutter_ed25519.dart │ │ ├── flutter_hmac.dart │ │ ├── flutter_pbkdf2.dart │ │ ├── flutter_rsa_pss.dart │ │ ├── flutter_rsa_ssa_pkcs1v15.dart │ │ └── flutter_x25519.dart │ │ └── flutter_cryptography.dart ├── macos │ ├── .gitignore │ ├── Classes │ │ └── CryptographyFlutterPlugin.swift │ └── cryptography_flutter.podspec └── pubspec.yaml ├── cryptography_flutter_integration_test ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── cryptography_flutter_integration_test │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── 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-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── integration_test │ └── integration_test.dart ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── 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 │ └── main.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.yaml ├── test │ ├── _android_crypto_provider.dart │ ├── _ciphers.dart │ ├── _ecdh.dart │ ├── _ecdsa.dart │ ├── _ed25519.dart │ ├── _flutter_cryptography.dart │ ├── _helpers.dart │ ├── _hmac.dart │ ├── _pbkdf2.dart.dart │ ├── _rsa_pss.dart │ ├── _rsa_ssa_pkcs1v15.dart │ ├── _x25519.dart │ └── main_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── cryptography_test ├── .gitignore ├── CHANGELOG.md ├── README.md ├── analysis_options.yaml ├── dart_test.yaml ├── lib │ ├── algorithms │ │ ├── aes_cbc.dart │ │ ├── aes_ctr.dart │ │ ├── aes_gcm.dart │ │ ├── argon2.dart │ │ ├── blake2b.dart │ │ ├── blake2s.dart │ │ ├── chacha20.dart │ │ ├── ecdh.dart │ │ ├── ecdsa.dart │ │ ├── ed25519.dart │ │ ├── hkdf.dart │ │ ├── hmac.dart │ │ ├── pbkdf2.dart │ │ ├── rsa_pss.dart │ │ ├── rsa_ssa_pkcs5v15.dart │ │ ├── sha224.dart │ │ ├── sha256.dart │ │ ├── sha384.dart │ │ ├── sha512.dart │ │ ├── x25519.dart │ │ └── xchacha20.dart │ ├── cipher.dart │ ├── cryptography_test.dart │ ├── hash.dart │ ├── hex.dart │ ├── key_exchange.dart │ └── signature.dart ├── pubspec.yaml └── test │ └── main_test.dart └── jwk ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── dart_test.yaml ├── lib └── jwk.dart ├── pubspec.yaml └── test └── jwk_test.dart /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [terrier989] 2 | open_collective: [cryptography] -------------------------------------------------------------------------------- /.github/workflows/dart.yml: -------------------------------------------------------------------------------- 1 | name: Dart CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest] 11 | sdk: [stable, beta, dev] 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: dart-lang/setup-dart@v1 15 | with: 16 | sdk: ${{ matrix.sdk }} 17 | - name: Run tests (cryptography) 18 | run: dart test --platform vm 19 | working-directory: ./cryptography 20 | - name: Run tests (cryptography_test) 21 | run: dart test --platform vm 22 | working-directory: ./cryptography_test 23 | - name: Run tests (jwk) 24 | run: dart test --platform vm 25 | working-directory: ./jwk 26 | - name: Analyze (cryptography) 27 | run: dart analyze 28 | working-directory: ./cryptography 29 | - name: Analyze (jwk) 30 | run: dart analyze 31 | working-directory: ./jwk -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | 15 | # Miscellaneous 16 | *.class 17 | *.log 18 | *.pyc 19 | *.swp 20 | .DS_Store 21 | .atom/ 22 | .buildlog/ 23 | .history 24 | .svn/ 25 | 26 | # IntelliJ related 27 | *.iml 28 | *.ipr 29 | *.iws 30 | .idea/ 31 | 32 | # The .vscode folder contains launch configuration and tasks you configure in 33 | # VS Code which you may wish to be included in version control, so this line 34 | # is commented out by default. 35 | .vscode/ 36 | 37 | # Flutter/Dart/Pub related 38 | **/doc/api/ 39 | **/ios/Flutter/.last_build_id 40 | .flutter-plugins 41 | .flutter-plugins-dependencies 42 | .pub-cache/ 43 | /build/ 44 | 45 | # Web related 46 | lib/generated_plugin_registrant.dart 47 | 48 | # Symbolication related 49 | app.*.symbols 50 | 51 | # Obfuscation related 52 | app.*.map.json 53 | 54 | # Android Studio will place build artifacts here 55 | /android/app/debug 56 | /android/app/profile 57 | /android/app/release 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Pub Package](https://img.shields.io/pub/v/cryptography.svg)](https://pub.dev/packages/cryptography) 2 | [![Github Actions CI](https://github.com/dint-dev/cryptography/workflows/Dart%20CI/badge.svg)](https://github.com/dint-dev/cryptography/actions?query=workflow%3A%22Dart+CI%22) 3 | 4 | # Overview 5 | 6 | Cryptographic packages for [Dart](https://dart.dev) / [Flutter](https://flutter.dev) developers. 7 | Open-sourced under the [Apache License 2.0](LICENSE). 8 | 9 | Maintained by [gohilla.com](https://gohilla.com). Licensed under the [Apache License 2.0](LICENSE). 10 | 11 | ## Packages 12 | * [cryptography](cryptography) 13 | * Cryptography API for Dart / Flutter. 14 | * Contains cryptographic algorithm implementations written in pure Dart. 15 | * Contains cryptographic algorithm implementations that use Web Cryptography API in browsers. 16 | * [cryptography_flutter](cryptography_flutter) 17 | * Contains cryptographic algorithm implementations that use operating system APIs in Android 18 | and Apple operating systems (iOS, Mac OS X, etc.). 19 | * [cryptography_flutter_integration_test](cryptography_flutter_integration_test) 20 | * Integration test project for "cryptography_flutter". 21 | * [cryptography_test](cryptography_flutter) 22 | * Cross-platform tests. Note that "cryptography" and "cryptography_flutter_integration_test" 23 | contain more tests than just these. 24 | * [jwk](jwk) 25 | * JWK (JSON Web Key) encoding / decoding. 26 | 27 | ## Contributing 28 | Please share feedback / issue reports in the 29 | [issue tracker](https://github.com/dint-dev/cryptography/issues). 30 | 31 | Pull requests are welcome. -------------------------------------------------------------------------------- /cryptography/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | 15 | # Miscellaneous 16 | *.class 17 | *.log 18 | *.pyc 19 | *.swp 20 | .DS_Store 21 | .atom/ 22 | .buildlog/ 23 | .history 24 | .svn/ 25 | 26 | # IntelliJ related 27 | *.iml 28 | *.ipr 29 | *.iws 30 | .idea/ 31 | 32 | # The .vscode folder contains launch configuration and tasks you configure in 33 | # VS Code which you may wish to be included in version control, so this line 34 | # is commented out by default. 35 | .vscode/ 36 | 37 | # Flutter/Dart/Pub related 38 | **/doc/api/ 39 | **/ios/Flutter/.last_build_id 40 | .flutter-plugins 41 | .flutter-plugins-dependencies 42 | .pub-cache/ 43 | /build/ 44 | 45 | # Web related 46 | lib/generated_plugin_registrant.dart 47 | 48 | # Symbolication related 49 | app.*.symbols 50 | 51 | # Obfuscation related 52 | app.*.map.json 53 | 54 | # Android Studio will place build artifacts here 55 | /android/app/debug 56 | /android/app/profile 57 | /android/app/release 58 | -------------------------------------------------------------------------------- /cryptography/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml -------------------------------------------------------------------------------- /cryptography/dart_test.yaml: -------------------------------------------------------------------------------- 1 | platforms: [ vm, chrome ] -------------------------------------------------------------------------------- /cryptography/example/lib/example.dart: -------------------------------------------------------------------------------- 1 | import 'package:cryptography/cryptography.dart'; 2 | 3 | Future main() async { 4 | final algorithm = AesGcm.with256bits(); 5 | 6 | // Generate a random 256-bit secret key 7 | final secretKey = await algorithm.newSecretKey(); 8 | 9 | // Generate a random 96-bit nonce. 10 | final nonce = algorithm.newNonce(); 11 | 12 | // Encrypt 13 | final clearText = [1, 2, 3]; 14 | final secretBox = await algorithm.encrypt( 15 | clearText, 16 | secretKey: secretKey, 17 | nonce: nonce, 18 | ); 19 | print('Ciphertext: ${secretBox.cipherText}'); 20 | print('MAC: ${secretBox.mac}'); 21 | } 22 | -------------------------------------------------------------------------------- /cryptography/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | environment: 4 | sdk: '>=2.17.0 <3.0.0' 5 | 6 | dependencies: 7 | cryptography: 8 | path: '..' -------------------------------------------------------------------------------- /cryptography/lib/browser.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// @nodoc 16 | @Deprecated( 17 | 'This library will be removed in a future major version.' 18 | ' You can find `BrowserCryptography` class in "package:cryptography/cryptography.dart".', 19 | ) 20 | library cryptography.browser; 21 | 22 | export 'src/browser/browser_cryptography_when_not_browser.dart' 23 | if (dart.library.html) 'src/browser/browser_cryptography.dart'; 24 | -------------------------------------------------------------------------------- /cryptography/lib/helpers.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// Various helpers for cryptography. 16 | library cryptography.helpers; 17 | 18 | export 'src/helpers/constant_time_equality.dart'; 19 | export 'src/helpers/delegating_classes.dart'; 20 | export 'src/helpers/math.dart'; 21 | export 'src/helpers/random_bytes.dart'; 22 | -------------------------------------------------------------------------------- /cryptography/lib/src/_internal/big_int.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:typed_data'; 16 | 17 | final _byteMask = BigInt.from(255); 18 | 19 | /// Converts bytes to [BigInt]. Uses little-endian byte order. 20 | BigInt bigIntFromBytes(List bytes) { 21 | var result = BigInt.zero; 22 | for (var i = bytes.length - 1; i >= 0; i--) { 23 | result = (result << 8) + BigInt.from(bytes[i]); 24 | } 25 | return result; 26 | } 27 | 28 | /// Converts [BigInt] to bytes. Uses little-endian byte order. 29 | Uint8List bigIntToBytes(BigInt? value, List result, 30 | [int start = 0, int? length]) { 31 | final original = value; 32 | length ??= result.length - start; 33 | for (var i = 0; i < length; i++) { 34 | result[start + i] = (_byteMask & value!).toInt(); 35 | value >>= 8; 36 | } 37 | if (value != BigInt.zero) { 38 | throw ArgumentError.value(original); 39 | } 40 | return result as Uint8List; 41 | } 42 | -------------------------------------------------------------------------------- /cryptography/lib/src/_internal/rotate.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// For ensuring that result of calculation will be 32-bit integer. 16 | const int uint32mask = 0xFFFFFFFF; 17 | 18 | /// Rotates 32-bit integer to the left. 19 | int rotateLeft32(int value, int shift) { 20 | assert(shift >= 0 && shift <= 32); 21 | return (uint32mask & (value << shift)) | (value >> (32 - shift)); 22 | } 23 | 24 | /// Rotates 32-bit integer to the right. 25 | int rotateRight32(int value, int shift) { 26 | assert(shift >= 0 && shift <= 32); 27 | return (uint32mask & (value << (32 - shift))) | (value >> shift); 28 | } 29 | -------------------------------------------------------------------------------- /cryptography/lib/src/cryptography/hash.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:cryptography/helpers.dart'; 17 | import 'package:meta/meta.dart'; 18 | 19 | /// A digest calculated with some [HashAlgorithm]. 20 | /// 21 | /// Two instances of this class are equal if the bytes are equal. 22 | /// 23 | /// Note that [toString()] exposes the bytes. 24 | @sealed 25 | class Hash { 26 | /// Bytes of the hash. 27 | final List bytes; 28 | 29 | @literal 30 | const Hash(this.bytes); 31 | 32 | @override 33 | int get hashCode => constantTimeBytesEquality.hash(bytes); 34 | 35 | @override 36 | bool operator ==(other) => 37 | other is Hash && constantTimeBytesEquality.equals(bytes, other.bytes); 38 | 39 | @override 40 | String toString() => 'Hash([${bytes.join(',')}])'; 41 | } 42 | -------------------------------------------------------------------------------- /cryptography/lib/src/cryptography/signature.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:collection/collection.dart'; 16 | import 'package:cryptography/cryptography.dart'; 17 | 18 | /// A digital signature by some [SignatureAlgorithm]. 19 | /// 20 | /// Use [SignatureAlgorithm.sign] to compute signatures and 21 | /// [SignatureAlgorithm.verify] to verify them. 22 | class Signature { 23 | /// Signature bytes. 24 | final List bytes; 25 | 26 | /// Public key of the signer. 27 | final PublicKey publicKey; 28 | 29 | const Signature(this.bytes, {required this.publicKey}); 30 | 31 | @override 32 | int get hashCode => 33 | const ListEquality().hash(bytes) ^ publicKey.hashCode; 34 | 35 | @override 36 | bool operator ==(other) => 37 | other is Signature && 38 | const ListEquality().equals(bytes, other.bytes) && 39 | publicKey == other.publicKey; 40 | 41 | @override 42 | String toString() => 43 | 'Signature([${bytes.join(', ')}], publicKey: $publicKey)'; 44 | } 45 | -------------------------------------------------------------------------------- /cryptography/lib/src/cryptography/wand.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:meta/meta.dart'; 17 | 18 | /// Superclass of [SignatureWand], [KeyExchangeWand], and [CipherWand]. 19 | /// 20 | /// The underlying secrets should be not extractable. Because instances of this 21 | /// class can still operate "locks" without a visible key, it is like a 22 | /// "magic wand". 23 | abstract class Wand { 24 | bool _hasBeenDestroyed = false; 25 | 26 | /// Whether [destroy] has been called. 27 | bool get hasBeenDestroyed => _hasBeenDestroyed; 28 | 29 | /// Prevents this object from being used anymore and attempts to erase 30 | /// cryptographic keys from memory. 31 | /// 32 | /// Calling this is optional. Any wand will be destroyed automatically 33 | /// when it is garbage collected, but the secrets may exist in the heap 34 | /// for some time before the are overwritten, potentially exposing them to 35 | /// memory dumps. 36 | @mustCallSuper 37 | Future destroy() async { 38 | _hasBeenDestroyed = true; 39 | } 40 | 41 | @override 42 | String toString() => '$runtimeType(...)'; 43 | } 44 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/argon2_impl_browser.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:typed_data'; 16 | 17 | import 'package:cryptography/dart.dart'; 18 | 19 | typedef DartArgon2StateImpl = DartArgon2StateImplBrowser; 20 | 21 | class DartArgon2StateImplBrowser extends DartArgon2State { 22 | ByteBuffer? _buffer; 23 | 24 | DartArgon2StateImplBrowser({ 25 | super.version, 26 | required super.mode, 27 | required super.parallelism, 28 | required super.memory, 29 | required super.iterations, 30 | required super.hashLength, 31 | super.maxIsolates, 32 | super.minBlocksPerSliceForEachIsolate, 33 | super.blocksPerProcessingChunk, 34 | ByteBuffer? buffer, 35 | }) : _buffer = buffer, 36 | super.constructor(); 37 | 38 | @override 39 | ByteBuffer getByteBuffer() { 40 | final oldBuffer = _buffer; 41 | if (oldBuffer != null) { 42 | return oldBuffer; 43 | } 44 | tryReleaseMemory(); 45 | final buffer = Uint32List(256 * blockCount).buffer; 46 | _buffer = buffer; 47 | return buffer; 48 | } 49 | 50 | @override 51 | void tryReleaseMemory() { 52 | if (isBufferUsed) { 53 | return; 54 | } 55 | _buffer = null; 56 | super.tryReleaseMemory(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/dart_signature_algorithm.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import '../../cryptography.dart'; 16 | 17 | /// A mixin for pure Dart implementations of [SignatureAlgorithm]. 18 | mixin DartSignatureAlgorithmMixin implements SignatureAlgorithm { 19 | @override 20 | Future sign( 21 | List input, { 22 | required KeyPair keyPair, 23 | }) async { 24 | final keyPairData = await keyPair.extract(); 25 | return signSync( 26 | input, 27 | keyPairData: keyPairData, 28 | ); 29 | } 30 | 31 | /// Signs a message synchronously (unlike [sign]). 32 | Signature signSync( 33 | List input, { 34 | required KeyPairData keyPairData, 35 | }); 36 | 37 | @override 38 | Future verify( 39 | List input, { 40 | required Signature signature, 41 | }) async { 42 | return verifySync(input, signature: signature); 43 | } 44 | 45 | /// Verifies a signature synchronously (unlike [verify]). 46 | bool verifySync( 47 | List input, { 48 | required Signature signature, 49 | }); 50 | } 51 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/rsa_pss.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:math'; 16 | 17 | import 'package:cryptography/cryptography.dart'; 18 | 19 | /// [RsaPss] implementation in pure Dart. Currently it throws 20 | /// [UnimplementedError] if you try to use it. 21 | /// 22 | /// For examples and more information about the algorithm, see documentation for 23 | /// the class [RsaPss]. 24 | class DartRsaPss extends RsaPss { 25 | @override 26 | final HashAlgorithm hashAlgorithm; 27 | 28 | @override 29 | final int nonceLengthInBytes; 30 | 31 | const DartRsaPss( 32 | this.hashAlgorithm, { 33 | this.nonceLengthInBytes = RsaPss.defaultNonceLengthInBytes, 34 | Random? random, 35 | }) : super.constructor(); 36 | 37 | @override 38 | Future newKeyPair( 39 | {int modulusLength = RsaPss.defaultModulusLength, 40 | List publicExponent = RsaPss.defaultPublicExponent}) { 41 | throw UnimplementedError(); 42 | } 43 | 44 | @override 45 | Future sign(List message, {required KeyPair keyPair}) { 46 | throw UnimplementedError(); 47 | } 48 | 49 | @override 50 | Future verify(List message, {required Signature signature}) { 51 | throw UnimplementedError(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/rsa_ssa_pkcs1v15.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:math'; 16 | 17 | import 'package:cryptography/cryptography.dart'; 18 | 19 | /// [DartRsaSsaPkcs1v15] implementation in pure Dart. Currently it throws 20 | /// [UnimplementedError] if you try to use it. 21 | /// 22 | /// For examples and more information about the algorithm, see documentation for 23 | /// the class [Ecdh]. 24 | class DartRsaSsaPkcs1v15 extends RsaSsaPkcs1v15 { 25 | @override 26 | final HashAlgorithm hashAlgorithm; 27 | 28 | const DartRsaSsaPkcs1v15( 29 | this.hashAlgorithm, { 30 | Random? random, 31 | }) : super.constructor(); 32 | 33 | @override 34 | Future newKeyPair({ 35 | int modulusLength = RsaSsaPkcs1v15.defaultModulusLength, 36 | List publicExponent = RsaSsaPkcs1v15.defaultPublicExponent, 37 | }) { 38 | throw UnimplementedError(); 39 | } 40 | 41 | @override 42 | Future sign(List message, {required KeyPair keyPair}) { 43 | throw UnimplementedError(); 44 | } 45 | 46 | @override 47 | Future verify(List message, {required Signature signature}) { 48 | throw UnimplementedError(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/sha1.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:crypto/crypto.dart' as other; 16 | import 'package:cryptography/cryptography.dart'; 17 | import 'package:cryptography/dart.dart'; 18 | import 'package:meta/meta.dart'; 19 | 20 | import '_helpers.dart'; 21 | 22 | /// [Sha1] implemented by using in [package:crypto](https://pub.dev/packages/crypto) 23 | /// (a package by Google). 24 | /// 25 | /// For examples and more information about the algorithm, see documentation for 26 | /// the class [Sha1]. 27 | class DartSha1 extends Sha1 28 | with DartHashAlgorithmMixin, PackageCryptoHashMixin { 29 | @literal 30 | const DartSha1() : super.constructor(); 31 | 32 | @override 33 | other.Hash get impl => other.sha1; 34 | } 35 | -------------------------------------------------------------------------------- /cryptography/lib/src/dart/sha512.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:crypto/crypto.dart' as other; 16 | import 'package:cryptography/cryptography.dart'; 17 | import 'package:cryptography/dart.dart'; 18 | import 'package:meta/meta.dart'; 19 | 20 | import '_helpers.dart'; 21 | 22 | /// [Sha384] implemented by using in [package:crypto](https://pub.dev/packages/crypto) 23 | /// (a package by Google). 24 | /// 25 | /// For examples and more information about the algorithm, see documentation for 26 | /// the class [Sha384]. 27 | class DartSha384 extends Sha384 28 | with DartHashAlgorithmMixin, PackageCryptoHashMixin { 29 | @literal 30 | const DartSha384() : super.constructor(); 31 | 32 | @override 33 | other.Hash get impl => other.sha384; 34 | } 35 | 36 | /// [Sha512] implemented by using in [package:crypto](https://pub.dev/packages/crypto) 37 | /// (a package by Google). 38 | /// 39 | /// For examples and more information about the algorithm, see documentation for 40 | /// the class [Sha512]. 41 | class DartSha512 extends Sha512 42 | with DartHashAlgorithmMixin, PackageCryptoHashMixin { 43 | @literal 44 | const DartSha512() : super.constructor(); 45 | 46 | @override 47 | other.Hash get impl => other.sha512; 48 | } 49 | -------------------------------------------------------------------------------- /cryptography/lib/src/helpers/math.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:typed_data'; 16 | 17 | /// Interprets the bytes a big endian integer and increments them by [int]. 18 | /// 19 | /// This can be useful for incrementing a nonce. 20 | /// 21 | /// ## Example 22 | /// ``` 23 | /// import 'package:cryptography/helpers.dart'; 24 | /// 25 | /// void main() { 26 | /// final bytes = [0,2,255]; 27 | /// bytesIncrementBigEndian(bytes, 5); 28 | /// // bytes become [0,3,4] 29 | /// } 30 | /// ``` 31 | void bytesIncrementBigEndian(Uint8List bytes, int n) { 32 | if (n < 0) { 33 | throw ArgumentError.value(n, 'n'); 34 | } 35 | for (var i = bytes.length - 1; n != 0 && i >= 0; i--) { 36 | final tmp = bytes[i] + n; 37 | bytes[i] = 0xFF & tmp; 38 | 39 | // Carry 40 | n = tmp ~/ 0x100; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cryptography/lib/src/helpers/random_bytes_impl_browser.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:html' as html; 16 | import 'dart:math'; 17 | import 'dart:typed_data'; 18 | 19 | import '../../cryptography.dart'; 20 | 21 | const _bit32 = 0x10000 * 0x10000; 22 | 23 | // Store the function so it can't be mutated by Javascript libraries. 24 | final _webCryptoRandom = html.window.crypto!.getRandomValues; 25 | 26 | void fillBytesWithSecureRandom(Uint8List bytes, {Random? random}) { 27 | if (random == null && 28 | bytes.runtimeType == Uint8List && 29 | BrowserCryptography.isSupported) { 30 | // Use Web Cryptography API directly (instead of Random.secure()). 31 | _webCryptoRandom(bytes); 32 | } 33 | random ??= SecureRandom.safe; 34 | for (var i = 0; i < bytes.length;) { 35 | if (i + 3 < bytes.length) { 36 | // Read 32 bits at a time. 37 | final x = random.nextInt(_bit32); 38 | bytes[i] = x >> 24; 39 | bytes[i + 1] = 0xFF & (x >> 16); 40 | bytes[i + 2] = 0xFF & (x >> 8); 41 | bytes[i + 3] = 0xFF & x; 42 | i += 4; 43 | } else { 44 | // Read 8 bits at a time. 45 | bytes[i] = random.nextInt(0x100); 46 | i++; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /cryptography/lib/src/helpers/random_bytes_impl_default.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:math'; 16 | import 'dart:typed_data'; 17 | 18 | import '../../cryptography.dart'; 19 | 20 | const _bit32 = 0x10000 * 0x10000; 21 | 22 | /// Fills a list with random bytes (using [Random.secure()]. 23 | void fillBytesWithSecureRandom(Uint8List bytes, {Random? random}) { 24 | random ??= SecureRandom.safe; 25 | for (var i = 0; i < bytes.length;) { 26 | if (i + 3 < bytes.length) { 27 | // Read 32 bits at a time. 28 | final x = random.nextInt(_bit32); 29 | bytes[i] = x >> 24; 30 | bytes[i + 1] = 0xFF & (x >> 16); 31 | bytes[i + 2] = 0xFF & (x >> 8); 32 | bytes[i + 3] = 0xFF & x; 33 | i += 4; 34 | } else { 35 | // Read 8 bits at a time. 36 | bytes[i] = random.nextInt(0x100); 37 | i++; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cryptography/lib/src/utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // THIS FILE IS NOT EXPORTED. 16 | 17 | export '_internal/big_int.dart'; 18 | export '_internal/bytes.dart'; 19 | export '_internal/hex.dart'; 20 | export '_internal/rotate.dart'; 21 | export 'helpers/constant_time_equality.dart'; 22 | export 'helpers/random_bytes.dart'; 23 | -------------------------------------------------------------------------------- /cryptography/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: cryptography 2 | version: 2.7.0 3 | homepage: https://github.com/dint-dev/cryptography 4 | description: 5 | Cryptographic algorithms for encryption, digital signatures, key agreement, authentication, and 6 | hashing. AES, Chacha20, ED25519, X25519, Argon2, and more. Good cross-platform support. 7 | 8 | environment: 9 | sdk: '>=3.1.0 <4.0.0' 10 | 11 | dependencies: 12 | # 13 | # Packages by Google: 14 | # 15 | collection: ^1.17.0 16 | crypto: ^3.0.3 17 | ffi: ^2.1.0 18 | js: ^0.6.7 19 | meta: ^1.8.0 20 | typed_data: ^1.3.0 21 | 22 | dev_dependencies: 23 | # 24 | # Packages by Google: 25 | # 26 | lints: ^2.1.1 27 | test: ^1.24.0 28 | -------------------------------------------------------------------------------- /cryptography/test/benchmark/benchmark_helpers.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:async'; 16 | 17 | /// A helper for "N op per second" benchmarks. 18 | abstract class SimpleBenchmark { 19 | final String _name; 20 | 21 | SimpleBenchmark(this._name); 22 | 23 | Future report() async { 24 | await setup(); 25 | try { 26 | await warmup(); 27 | var watch = Stopwatch(); 28 | watch.start(); 29 | var n = 0; 30 | while (watch.elapsedMilliseconds < 200) { 31 | final possibleFuture = run(); 32 | if (possibleFuture is Future) { 33 | await possibleFuture; 34 | } 35 | n++; 36 | } 37 | watch.stop(); 38 | 39 | n = (n * (1000000 / watch.elapsed.inMicroseconds)).ceil(); 40 | final prefix = '$_name:'.padRight(32, ' '); 41 | print('$prefix $n op / second'); 42 | } finally { 43 | await teardown(); 44 | } 45 | } 46 | 47 | FutureOr run(); 48 | 49 | FutureOr setup() {} 50 | 51 | FutureOr teardown() {} 52 | 53 | FutureOr warmup() async { 54 | for (var i = 0; i < 5; i++) { 55 | await run(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cryptography/test/benchmark/cipher_with_gigabytes_of_input.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:cryptography/cryptography.dart'; 5 | 6 | Future main() async { 7 | final stopwatch = Stopwatch()..start(); 8 | final timer = Timer.periodic(const Duration(seconds: 5), (timer) { 9 | print('${stopwatch.elapsed.inSeconds} seconds'); 10 | }); 11 | final algo = Chacha20(macAlgorithm: MacAlgorithm.empty); 12 | final secretKey = await algo.newSecretKey(); 13 | final nonce = algo.newNonce(); 14 | final encryptedStream = algo.encryptStream( 15 | _stream(), 16 | secretKey: secretKey, 17 | nonce: nonce, 18 | onMac: (_) {}, 19 | ); 20 | var n = 0; 21 | await for (var _ in encryptedStream) { 22 | n++; 23 | if (n % million == 0) { 24 | print('Encrypted ${n ~/ million} GB'); 25 | } 26 | } 27 | timer.cancel(); 28 | } 29 | 30 | const million = 1000000; 31 | 32 | // 1 kilobyte 33 | final data = Uint8List(1024); 34 | 35 | Stream> _stream() async* { 36 | for (var i = 0; i < 64 * million; i++) { 37 | yield data; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /cryptography/test/benchmark/key_exchange.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import 'benchmark_helpers.dart'; 18 | 19 | Future main() async { 20 | final cryptography = Cryptography.instance; 21 | await _SharedSecret(cryptography.x25519()).report(); 22 | } 23 | 24 | class _SharedSecret extends SimpleBenchmark { 25 | final KeyExchangeAlgorithm implementation; 26 | 27 | late KeyPair keyPair0; 28 | 29 | late KeyPair keyPair1; 30 | 31 | _SharedSecret(this.implementation) 32 | : super('$implementation.sharedSecretKey(...)'); 33 | 34 | @override 35 | Future run() async { 36 | await implementation.sharedSecretKey( 37 | keyPair: keyPair0, 38 | remotePublicKey: await keyPair1.extractPublicKey(), 39 | ); 40 | } 41 | 42 | @override 43 | Future setup() async { 44 | keyPair0 = await implementation.newKeyPair(); 45 | keyPair1 = await implementation.newKeyPair(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cryptography/test/benchmark/pkbdf.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import 'benchmark_helpers.dart'; 18 | 19 | Future main() async { 20 | await _Benchmark(Pbkdf2.hmacSha256(iterations: 100000, bits: 128)).report(); 21 | } 22 | 23 | class _Benchmark extends SimpleBenchmark { 24 | final Pbkdf2 implementation; 25 | 26 | _Benchmark(this.implementation) : super('$implementation.deriveKey(...)'); 27 | 28 | @override 29 | Future run() async { 30 | await implementation.deriveKey( 31 | secretKey: SecretKey([1, 2, 3]), 32 | nonce: [4, 5, 6], 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /cryptography/test/benchmark/random.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:math'; 16 | 17 | import 'package:cryptography/cryptography.dart'; 18 | 19 | import 'benchmark_helpers.dart'; 20 | 21 | Future main() async { 22 | const times = 1 << 16; 23 | await _Random(SecureRandom.fast, times).report(); 24 | await _Random(SecureRandom.safe, times).report(); 25 | } 26 | 27 | class _Random extends SimpleBenchmark { 28 | final Random random; 29 | final int n; 30 | 31 | _Random(this.random, this.n) 32 | : super('$random.nextInt(...), $n times'.padRight(20)); 33 | 34 | @override 35 | Future run() async { 36 | for (var i = 0; i < n; i++) { 37 | random.nextInt(0x100000000); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cryptography/test/hash_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:test/test.dart'; 17 | 18 | void main() { 19 | group('Hash:', () { 20 | test('"==" / hashCode', () { 21 | const value = Hash([3, 1, 4]); 22 | const clone = Hash([3, 1, 4]); 23 | const other0 = Hash([3, 1, 999]); 24 | const other1 = Hash([3, 1, 4, 999]); 25 | const other2 = Hash([3, 1]); 26 | 27 | expect(value, clone); 28 | expect(value, isNot(other0)); 29 | expect(value, isNot(other1)); 30 | expect(value, isNot(other2)); 31 | 32 | expect(value.hashCode, clone.hashCode); 33 | expect(value.hashCode, isNot(other0.hashCode)); 34 | expect(value.hashCode, isNot(other1.hashCode)); 35 | expect(value.hashCode, isNot(other2.hashCode)); 36 | }); 37 | 38 | test('toString()', () { 39 | const value = Hash([3, 1, 4]); 40 | expect(value.toString(), 'Hash([3,1,4])'); 41 | }); 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /cryptography/test/mac_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:test/test.dart'; 17 | 18 | void main() { 19 | group('Mac:', () { 20 | test('"==" / hashCode', () { 21 | const value = Mac([3, 1, 4]); 22 | const clone = Mac([3, 1, 4]); 23 | const other0 = Mac([3, 1, 999]); 24 | const other1 = Mac([3, 1, 4, 999]); 25 | const other2 = Mac([3, 1]); 26 | 27 | expect(value, clone); 28 | expect(value, isNot(other0)); 29 | expect(value, isNot(other1)); 30 | expect(value, isNot(other2)); 31 | 32 | expect(value.hashCode, clone.hashCode); 33 | expect(value.hashCode, isNot(other0.hashCode)); 34 | expect(value.hashCode, isNot(other1.hashCode)); 35 | expect(value.hashCode, isNot(other2.hashCode)); 36 | }); 37 | 38 | test('toString() when non-empty', () { 39 | const value = Mac([3, 1, 4]); 40 | expect(value.toString(), 'Mac([3,1,4])'); 41 | }); 42 | 43 | test('toString() when empty', () { 44 | const value = Mac.empty; 45 | expect(value.bytes, isEmpty); 46 | expect(value.toString(), 'Mac.empty'); 47 | }); 48 | }); 49 | } 50 | -------------------------------------------------------------------------------- /cryptography/test/simple_public_key_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:test/test.dart'; 17 | 18 | void main() { 19 | group('SimplePublicKey:', () { 20 | test('"==" / hashCode', () { 21 | final value = SimplePublicKey([3, 1, 4], type: KeyPairType.ed25519); 22 | final clone = SimplePublicKey([3, 1, 4], type: KeyPairType.ed25519); 23 | final other0 = SimplePublicKey([3, 1, 999], type: KeyPairType.ed25519); 24 | final other1 = SimplePublicKey([3, 1, 4, 999], type: KeyPairType.ed25519); 25 | 26 | expect(value, clone); 27 | expect(value, isNot(other0)); 28 | expect(value, isNot(other1)); 29 | 30 | expect(value.hashCode, clone.hashCode); 31 | expect(value.hashCode, isNot(other0.hashCode)); 32 | expect(value.hashCode, isNot(other1.hashCode)); 33 | }); 34 | 35 | test('toString()', () { 36 | final a = SimplePublicKey( 37 | [1, 2], 38 | type: KeyPairType.ed25519, 39 | ); 40 | expect( 41 | a.toString(), 42 | 'SimplePublicKey([1,2], type: KeyPairType.ed25519)', 43 | ); 44 | }); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /cryptography/test/utils_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/helpers.dart'; 16 | import 'package:test/test.dart'; 17 | 18 | void main() { 19 | test('randomBytes()', () { 20 | for (var i = 1; i < 100; i++) { 21 | final s = randomBytes(i); 22 | expect(s.length, i); 23 | expect(s.toSet(), hasLength(greaterThan(s.length ~/ 8))); 24 | } 25 | }); 26 | 27 | test('randomBytesAsHexString()', () { 28 | for (var i = 1; i < 100; i++) { 29 | final s = randomBytesAsHexString(i); 30 | expect(s.length, 2 * i); 31 | if (i >= 32) { 32 | expect(s.codeUnits.toSet(), hasLength(greaterThan(8))); 33 | } 34 | } 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /cryptography_flutter/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | .vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /cryptography_flutter/.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: 652bc59414cf04fd841e15b250c1de4fda00d38a 8 | channel: master 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /cryptography_flutter/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml -------------------------------------------------------------------------------- /cryptography_flutter/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .cxx 10 | -------------------------------------------------------------------------------- /cryptography_flutter/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'dev.dint.cryptography_flutter' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.7.10' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:7.2.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 31 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | minSdkVersion 21 45 | } 46 | } 47 | 48 | dependencies { 49 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 50 | implementation "androidx.security:security-crypto:1.1.0-alpha05" 51 | } -------------------------------------------------------------------------------- /cryptography_flutter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /cryptography_flutter/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'cryptography_flutter' 2 | -------------------------------------------------------------------------------- /cryptography_flutter/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /cryptography_flutter/example/README.md: -------------------------------------------------------------------------------- 1 | # Running the example 2 | 3 | In the command line, run the following command: 4 | 5 | ``` 6 | flutter run 7 | ``` 8 | -------------------------------------------------------------------------------- /cryptography_flutter/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /cryptography_flutter/example/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 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /cryptography_flutter/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /cryptography_flutter/example/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 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - cryptography_flutter (0.2.0): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - cryptography_flutter (from `.symlinks/plugins/cryptography_flutter/ios`) 8 | - Flutter (from `Flutter`) 9 | 10 | EXTERNAL SOURCES: 11 | cryptography_flutter: 12 | :path: ".symlinks/plugins/cryptography_flutter/ios" 13 | Flutter: 14 | :path: Flutter 15 | 16 | SPEC CHECKSUMS: 17 | cryptography_flutter: 381bdacc984abcfbe3ca45ef7c76566ff061614c 18 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 19 | 20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 21 | 22 | COCOAPODS: 1.11.2 23 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/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 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/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 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /cryptography_flutter/example/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 4 | this directory. 5 | 6 | You can also do it by opening your Flutter project's Xcode project 7 | with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and 8 | dropping in the desired images. -------------------------------------------------------------------------------- /cryptography_flutter/example/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 | -------------------------------------------------------------------------------- /cryptography_flutter/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /cryptography_flutter/example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import cryptography_flutter 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | CryptographyFlutterPlugin.register(with: registry.registrar(forPlugin: "CryptographyFlutterPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - cryptography_flutter (0.2.0): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - cryptography_flutter (from `Flutter/ephemeral/.symlinks/plugins/cryptography_flutter/macos`) 8 | - FlutterMacOS (from `Flutter/ephemeral`) 9 | 10 | EXTERNAL SOURCES: 11 | cryptography_flutter: 12 | :path: Flutter/ephemeral/.symlinks/plugins/cryptography_flutter/macos 13 | FlutterMacOS: 14 | :path: Flutter/ephemeral 15 | 16 | SPEC CHECKSUMS: 17 | cryptography_flutter: c9fa581b52e6fe19475432b6f44489c387f61e19 18 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 19 | 20 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 21 | 22 | COCOAPODS: 1.11.2 23 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /cryptography_flutter/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | publish_to: 'none' 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=2.19.2 <3.0.0' 8 | 9 | dependencies: 10 | cryptography: 11 | cryptography_flutter: 12 | flutter: 13 | sdk: flutter 14 | cupertino_icons: ^1.0.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^2.0.3 20 | 21 | flutter: 22 | uses-material-design: true 23 | 24 | dependency_overrides: 25 | cryptography: 26 | path: ../../cryptography 27 | cryptography_flutter: 28 | path: ../ -------------------------------------------------------------------------------- /cryptography_flutter/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/web/favicon.png -------------------------------------------------------------------------------- /cryptography_flutter/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /cryptography_flutter/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /cryptography_flutter/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /cryptography_flutter/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /cryptography_flutter/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /cryptography_flutter/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /cryptography_flutter/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /cryptography_flutter/ios/cryptography_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint cryptography_flutter.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'cryptography_flutter' 7 | s.version = '0.2.0' 8 | s.summary = 'A cryptography plugin for Flutter.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://github.com/dint-dev/cryptography' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Gohilla' => 'opensource@gohilla.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.platform = :ios, '8.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/cryptography_flutter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// An optimized version of [package:cryptography](https://pub.dev/packages/cryptography). 16 | /// 17 | /// See [FlutterCryptography] for usage instructions. 18 | library cryptography_flutter; 19 | 20 | import 'package:cryptography_flutter/cryptography_flutter.dart'; 21 | 22 | export 'src/background/background_aes_gcm.dart'; 23 | export 'src/background/background_chacha20.dart'; 24 | export 'src/background/background_cipher.dart'; 25 | export 'src/background/background_pbkdf2.dart'; 26 | export 'src/cryptography_channel_policy.dart'; 27 | export 'src/cryptography_channel_queue.dart'; 28 | export 'src/cryptography_unsupported_error.dart'; 29 | export 'src/flutter/flutter_aes_gcm.dart'; 30 | export 'src/flutter/flutter_chacha20.dart'; 31 | export 'src/flutter/flutter_cipher.dart'; 32 | export 'src/flutter/flutter_ecdh.dart'; 33 | export 'src/flutter/flutter_ecdsa.dart'; 34 | export 'src/flutter/flutter_ed25519.dart'; 35 | export 'src/flutter/flutter_pbkdf2.dart'; 36 | export 'src/flutter/flutter_rsa_pss.dart'; 37 | export 'src/flutter/flutter_rsa_ssa_pkcs1v15.dart'; 38 | export 'src/flutter/flutter_x25519.dart'; 39 | export 'src/flutter_cryptography.dart'; 40 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/src/_flutter_cryptography_implementation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// Interface for cryptographic algorithms that can use platform APIs. 16 | mixin PlatformCryptographicAlgorithm { 17 | /// Fallback implementation. 18 | Object? get fallback; 19 | 20 | /// Whether this algorithm is expected to be able to use platform APIs. 21 | bool get isSupportedPlatform; 22 | } 23 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/src/_internal_impl_browser.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | bool get isAndroid => false; 16 | 17 | bool get isIOS => false; 18 | 19 | bool get isMacOS => false; 20 | 21 | String get operatingSystemNameAndVersion => 'browser'; 22 | 23 | String get operatingSystemName => 'browser'; 24 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/src/_internal_impl_non_browser.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:io'; 16 | 17 | final bool isAndroid = Platform.isAndroid; 18 | 19 | final bool isIOS = Platform.isIOS; 20 | 21 | final bool isMacOS = Platform.isMacOS; 22 | 23 | /// For example, "iOS 13.3.1". 24 | String get operatingSystemNameAndVersion => 25 | '${Platform.operatingSystem} ${Platform.operatingSystemVersion}'; 26 | 27 | /// For example, "iOS". 28 | String get operatingSystemName => Platform.operatingSystem; 29 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/src/cryptography_channel_policy.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/foundation.dart'; 16 | 17 | /// Describes when to pass computation to plugin or another isolate. 18 | class CryptographyChannelPolicy { 19 | static const CryptographyChannelPolicy never = CryptographyChannelPolicy( 20 | minLength: 0, 21 | maxLength: 0, 22 | ); 23 | 24 | /// Minimum length of data for processing in the plugin. 25 | final int minLength; 26 | 27 | /// Maximum length of data for processing in the plugin. 28 | final int? maxLength; 29 | 30 | const CryptographyChannelPolicy({ 31 | required this.minLength, 32 | required this.maxLength, 33 | }); 34 | 35 | bool matches({required int length}) { 36 | if (kIsWeb || length < minLength) { 37 | return false; 38 | } 39 | final maxLength = this.maxLength; 40 | return maxLength == null || length < maxLength; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cryptography_flutter/lib/src/cryptography_unsupported_error.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /cryptography_flutter/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /cryptography_flutter/macos/cryptography_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint cryptography_flutter.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'cryptography_flutter' 7 | s.version = '0.2.0' 8 | s.summary = 'A cryptography plugin for Flutter.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://github.com/dint-dev/cryptography' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Gohilla' => 'opensource@gohilla.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'FlutterMacOS' 18 | 19 | s.platform = :osx, '10.11' 20 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 21 | s.swift_version = '5.0' 22 | end -------------------------------------------------------------------------------- /cryptography_flutter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: cryptography_flutter 2 | description: 3 | Makes 'package:cryptography' use platform APIs in Android, iOS, and Mac OS X. The package can 4 | make performance up to 100 times better. 5 | version: 2.3.2 6 | homepage: https://github.com/dint-dev/cryptography 7 | 8 | environment: 9 | sdk: '>=3.1.0 <4.0.0' 10 | flutter: '>=3.13.0' 11 | 12 | # Open-source contributors: 13 | # 14 | # If you add a dependency to the package, please help 15 | # readers of pubspec.yaml to understand who maintains it 16 | # and any other useful information about it. 17 | dependencies: 18 | # 19 | # Packages by github.com/dint-dev: 20 | # 21 | cryptography: ^2.7.0 22 | 23 | flutter: 24 | sdk: flutter 25 | 26 | dev_dependencies: 27 | flutter_test: 28 | sdk: flutter 29 | flutter_lints: ^2.0.3 30 | 31 | dependency_overrides: 32 | cryptography: 33 | path: ../cryptography 34 | 35 | flutter: 36 | plugin: 37 | platforms: 38 | android: 39 | package: dev.dint.cryptography_flutter 40 | pluginClass: CryptographyFlutterPlugin 41 | dartPluginClass: FlutterCryptography 42 | ios: 43 | pluginClass: CryptographyFlutterPlugin 44 | dartPluginClass: FlutterCryptography 45 | linux: 46 | dartPluginClass: FlutterCryptography 47 | macos: 48 | pluginClass: CryptographyFlutterPlugin 49 | dartPluginClass: FlutterCryptography 50 | windows: 51 | dartPluginClass: FlutterCryptography 52 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/README.md: -------------------------------------------------------------------------------- 1 | # Running tests 2 | ``` 3 | flutter test integration_test 4 | ``` -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/kotlin/com/example/cryptography_flutter_integration_test/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.cryptography_flutter_integration_test 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/integration_test/integration_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:integration_test/integration_test.dart'; 16 | 17 | import '../test/main_test.dart' as main_test; 18 | 19 | void main() { 20 | IntegrationTestWidgetsFlutterBinding.ensureInitialized(); 21 | main_test.runTests(); 22 | } 23 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - cryptography_flutter (0.2.0): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - integration_test (0.0.1): 6 | - Flutter 7 | 8 | DEPENDENCIES: 9 | - cryptography_flutter (from `.symlinks/plugins/cryptography_flutter/ios`) 10 | - Flutter (from `Flutter`) 11 | - integration_test (from `.symlinks/plugins/integration_test/ios`) 12 | 13 | EXTERNAL SOURCES: 14 | cryptography_flutter: 15 | :path: ".symlinks/plugins/cryptography_flutter/ios" 16 | Flutter: 17 | :path: Flutter 18 | integration_test: 19 | :path: ".symlinks/plugins/integration_test/ios" 20 | 21 | SPEC CHECKSUMS: 22 | cryptography_flutter: 381bdacc984abcfbe3ca45ef7c76566ff061614c 23 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 24 | integration_test: 13825b8a9334a850581300559b8839134b124670 25 | 26 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 27 | 28 | COCOAPODS: 1.11.2 29 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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. -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/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 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import cryptography_flutter 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | CryptographyFlutterPlugin.register(with: registry.registrar(forPlugin: "CryptographyFlutterPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - cryptography_flutter (0.2.0): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - cryptography_flutter (from `Flutter/ephemeral/.symlinks/plugins/cryptography_flutter/macos`) 8 | - FlutterMacOS (from `Flutter/ephemeral`) 9 | 10 | EXTERNAL SOURCES: 11 | cryptography_flutter: 12 | :path: Flutter/ephemeral/.symlinks/plugins/cryptography_flutter/macos 13 | FlutterMacOS: 14 | :path: Flutter/ephemeral 15 | 16 | SPEC CHECKSUMS: 17 | cryptography_flutter: c9fa581b52e6fe19475432b6f44489c387f61e19 18 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 19 | 20 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 21 | 22 | COCOAPODS: 1.11.2 23 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = cryptography_flutter_integration_test 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.cryptographyFlutterIntegrationTest 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: cryptography_flutter_integration_test 2 | description: A new Flutter project. 3 | publish_to: 'none' 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=3.1.0 <4.0.0' 8 | flutter: '>=3.13.0' 9 | 10 | dependencies: 11 | cryptography: ^2.6.0 12 | cryptography_flutter: ^2.3.1 13 | flutter: 14 | sdk: flutter 15 | cupertino_icons: ^1.0.2 16 | 17 | dev_dependencies: 18 | cryptography_test: ^0.1.0 19 | flutter_test: 20 | sdk: flutter 21 | integration_test: 22 | sdk: flutter 23 | flutter_lints: ^2.0.3 24 | 25 | flutter: 26 | uses-material-design: true 27 | 28 | dependency_overrides: 29 | cryptography: 30 | path: ../cryptography 31 | cryptography_flutter: 32 | path: ../cryptography_flutter 33 | cryptography_test: 34 | path: ../cryptography_test -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_android_crypto_provider.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:io'; 16 | 17 | import 'package:cryptography_flutter/android.dart'; 18 | import 'package:flutter/foundation.dart'; 19 | import 'package:flutter_test/flutter_test.dart'; 20 | 21 | void testAndroidCryptoProvider() { 22 | if (!kIsWeb && Platform.isAndroid) { 23 | test('AndroidCryptoProvider.all', () async { 24 | final providers = await AndroidCryptoProvider.all(); 25 | expect(providers, hasLength(greaterThan(1))); 26 | }); 27 | 28 | test('AndroidCryptoProvider.add("non-existing")', () async { 29 | try { 30 | await AndroidCryptoProvider.add(className: 'nonExistingCryptoProvider'); 31 | } catch (e) { 32 | expect(e.toString(), contains('java.lang.ClassNotFoundException')); 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_ecdh.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography_test/algorithms/ecdh.dart' as shared; 16 | 17 | void testEcdh() { 18 | shared.testEcdh(); 19 | } 20 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_ecdsa.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography_test/algorithms/ecdsa.dart' as shared; 16 | 17 | void testEcdsa() { 18 | shared.testEcdsa(); 19 | } 20 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_hmac.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography_test/algorithms/hmac.dart' as shared; 16 | 17 | void testHmac() { 18 | shared.testHmac(); 19 | } 20 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_rsa_pss.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:cryptography/dart.dart'; 17 | import 'package:cryptography_flutter/cryptography_flutter.dart'; 18 | import 'package:cryptography_test/algorithms/rsa_pss.dart' as shared; 19 | import 'package:flutter_test/flutter_test.dart'; 20 | 21 | void testRsaPss() { 22 | group('RsaPss', () { 23 | if (!FlutterRsaPss(DartRsaPss(Sha256())).isSupportedPlatform) { 24 | return; 25 | } 26 | shared.testRsaPss(); 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/test/_rsa_ssa_pkcs1v15.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2020 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | import 'package:cryptography/dart.dart'; 17 | import 'package:cryptography_flutter/cryptography_flutter.dart'; 18 | import 'package:cryptography_test/algorithms/rsa_ssa_pkcs5v15.dart' as shared; 19 | import 'package:flutter_test/flutter_test.dart'; 20 | 21 | void testRsaSsaPkcs1v15() { 22 | group('RsaSsaPkcs1v15', () { 23 | if (!FlutterRsaSsaPkcs1v15(DartRsaSsaPkcs1v15(Sha256())) 24 | .isSupportedPlatform) { 25 | return; 26 | } 27 | shared.testRsaSsaPkcs5v1(); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/web/favicon.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/web/icons/Icon-192.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/web/icons/Icon-512.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cryptography_flutter_integration_test", 3 | "short_name": "cryptography_flutter_integration_test", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"cryptography_flutter_integration_test", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dint-dev/cryptography/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter_integration_test/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /cryptography_flutter_integration_test/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /cryptography_test/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | 15 | # Miscellaneous 16 | *.class 17 | *.log 18 | *.pyc 19 | *.swp 20 | .DS_Store 21 | .atom/ 22 | .buildlog/ 23 | .history 24 | .svn/ 25 | 26 | # IntelliJ related 27 | *.iml 28 | *.ipr 29 | *.iws 30 | .idea/ 31 | 32 | # The .vscode folder contains launch configuration and tasks you configure in 33 | # VS Code which you may wish to be included in version control, so this line 34 | # is commented out by default. 35 | .vscode/ 36 | 37 | # Flutter/Dart/Pub related 38 | **/doc/api/ 39 | **/ios/Flutter/.last_build_id 40 | .flutter-plugins 41 | .flutter-plugins-dependencies 42 | .pub-cache/ 43 | /build/ 44 | 45 | # Web related 46 | lib/generated_plugin_registrant.dart 47 | 48 | # Symbolication related 49 | app.*.symbols 50 | 51 | # Obfuscation related 52 | app.*.map.json 53 | 54 | # Android Studio will place build artifacts here 55 | /android/app/debug 56 | /android/app/profile 57 | /android/app/release 58 | -------------------------------------------------------------------------------- /cryptography_test/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.0 2 | * Initial version -------------------------------------------------------------------------------- /cryptography_test/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | If you are implementing a cryptographic algorithm that implements interfaces of 4 | [pub.dev/packages/cryptography](https://pub.dev/packages/cryptography), this package helps you test 5 | that: 6 | 7 | * Your implementation complies with the API specifications. 8 | * Your implementation doesn't fail any sanity checks. 9 | * Your implementation produces same outputs as some existing implementation (when there is one). 10 | 11 | # Usage 12 | 13 | In pubspec.yaml: 14 | 15 | ```yaml 16 | dev_dependencies: 17 | cryptography_test: any 18 | ``` 19 | 20 | If you have something like: 21 | ```dart 22 | import 'package:cryptography/cryptography.dart'; 23 | 24 | class MyExample extends Cipher { 25 | // ... 26 | } 27 | ``` 28 | 29 | Your unit tests will look like: 30 | ```dart 31 | import 'package:cryptography_test/cryptography_test.dart'; 32 | import 'package:cryptography_test/cipher.dart'; 33 | 34 | void main() { 35 | testCipher( 36 | builder: () => MyCipher(someParameter: 123), 37 | // `testCipher` will do various automatic sanity checks such as: 38 | // decrypt(encrypt(input)) 39 | // ...with various interesting inputs. 40 | // 41 | // You can give it real test vectors too: 42 | otherTests: () { 43 | test('test vector', () async { 44 | await expectCipherExample( 45 | clearText: hexToBytes('01 23 45 67 89 ab cd ef'), 46 | secretKey: hexToBytes('01 23 45 67 89 ab cd ef'), 47 | nonce: hexToBytes('01 23 45 67 89 ab cd ef'), 48 | aad: hexToBytes('01 23 45 67 89 ab cd ef'), 49 | cipherText: hexToBytes('01 23 45 67 89 ab cd ef'), 50 | mac: hexToBytes('01 23 45 67 89 ab cd ef'), 51 | ); 52 | }); 53 | }, 54 | ); 55 | } 56 | ``` -------------------------------------------------------------------------------- /cryptography_test/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml -------------------------------------------------------------------------------- /cryptography_test/dart_test.yaml: -------------------------------------------------------------------------------- 1 | platforms: [ vm, chrome ] -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/aes_ctr.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../cipher.dart'; 18 | 19 | void testAesCtr() { 20 | testCipher( 21 | builder: () => AesCtr.with128bits( 22 | macAlgorithm: MacAlgorithm.empty, 23 | ), 24 | ); 25 | testCipher( 26 | builder: () => AesCtr.with128bits( 27 | macAlgorithm: Hmac.sha256(), 28 | ), 29 | ); 30 | testCipher( 31 | builder: () => AesCtr.with192bits( 32 | macAlgorithm: MacAlgorithm.empty, 33 | ), 34 | ); 35 | testCipher( 36 | builder: () => AesCtr.with256bits( 37 | macAlgorithm: MacAlgorithm.empty, 38 | ), 39 | ); 40 | testCipher( 41 | builder: () => AesCtr.with256bits( 42 | macAlgorithm: Hmac.sha256(), 43 | ), 44 | ); 45 | testCipher( 46 | builder: () => AesCtr.with256bits( 47 | macAlgorithm: Hmac.sha512(), 48 | ), 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/blake2b.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testBlake2b() { 20 | testHashAlgorithm( 21 | builder: () => Blake2b(), 22 | otherTests: () { 23 | // ... 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/blake2s.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testBlake2s() { 20 | testHashAlgorithm( 21 | builder: () => Blake2s(), 22 | otherTests: () { 23 | // ... 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/chacha20.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../cipher.dart'; 18 | 19 | void testChacha20() { 20 | testCipher( 21 | builder: () => Chacha20(macAlgorithm: MacAlgorithm.empty), 22 | ); 23 | testCipher( 24 | builder: () => Chacha20(macAlgorithm: Hmac.sha256()), 25 | ); 26 | testCipher( 27 | builder: () => Chacha20(macAlgorithm: Hmac.sha512()), 28 | ); 29 | testCipher( 30 | builder: () => Chacha20.poly1305Aead(), 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/rsa_pss.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../signature.dart'; 18 | 19 | void testRsaPss() { 20 | testSignatureAlgorithm( 21 | builder: () => RsaPss(Sha256()), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/rsa_ssa_pkcs5v15.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../signature.dart'; 18 | 19 | void testRsaSsaPkcs5v1() { 20 | testSignatureAlgorithm( 21 | builder: () => RsaSsaPkcs1v15(Sha256()), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/sha224.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testSha224() { 20 | testHashAlgorithm( 21 | builder: () => Sha224(), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/sha256.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testSha256() { 20 | testHashAlgorithm( 21 | builder: () => Sha256(), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/sha384.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testSha384() { 20 | testHashAlgorithm( 21 | builder: () => Sha384(), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/sha512.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../hash.dart'; 18 | 19 | void testSha512() { 20 | testHashAlgorithm( 21 | builder: () => Sha512(), 22 | otherTests: () { 23 | // TODO: Copy test vectors from "cryptography/test/..." 24 | }, 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /cryptography_test/lib/algorithms/xchacha20.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography/cryptography.dart'; 16 | 17 | import '../cipher.dart'; 18 | 19 | void testXchacha20() { 20 | testCipher( 21 | builder: () => Xchacha20(macAlgorithm: MacAlgorithm.empty), 22 | ); 23 | testCipher( 24 | builder: () => Xchacha20(macAlgorithm: Hmac.sha256()), 25 | ); 26 | testCipher( 27 | builder: () => Xchacha20(macAlgorithm: Hmac.sha512()), 28 | ); 29 | testCipher( 30 | builder: () => Xchacha20.poly1305Aead(), 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /cryptography_test/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: cryptography_test 2 | version: 0.1.0 3 | homepage: https://github.com/dint-dev/cryptography 4 | description: A package for testing and benchmarking cryptographic algorithm implementations that 5 | implement "package:cryptography" interfaces. 6 | 7 | environment: 8 | sdk: '>=3.1.0 <4.0.0' 9 | 10 | # Open-source contributors: 11 | # 12 | # If you add a dependency to the package, please help 13 | # readers of pubspec.yaml to understand who maintains it 14 | # and any other useful information about it. 15 | dependencies: 16 | # 17 | # Packages by Google: 18 | # 19 | collection: ^1.17.0 20 | crypto: ^3.0.3 21 | test: ^1.24.0 22 | typed_data: ^1.3.0 23 | 24 | # 25 | # Packages by github.com/dint-dev: 26 | # 27 | cryptography: ^2.5.1 28 | 29 | dev_dependencies: 30 | # 31 | # Packages by Google: 32 | # 33 | lints: ^2.1.1 34 | 35 | dependency_overrides: 36 | cryptography: 37 | path: ../cryptography -------------------------------------------------------------------------------- /cryptography_test/test/main_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Gohilla. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:cryptography_test/cryptography_test.dart'; 16 | 17 | void main() { 18 | testCryptography(); 19 | } 20 | -------------------------------------------------------------------------------- /jwk/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | 15 | # Miscellaneous 16 | *.class 17 | *.log 18 | *.pyc 19 | *.swp 20 | .DS_Store 21 | .atom/ 22 | .buildlog/ 23 | .history 24 | .svn/ 25 | 26 | # IntelliJ related 27 | *.iml 28 | *.ipr 29 | *.iws 30 | .idea/ 31 | 32 | # The .vscode folder contains launch configuration and tasks you configure in 33 | # VS Code which you may wish to be included in version control, so this line 34 | # is commented out by default. 35 | .vscode/ 36 | 37 | # Flutter/Dart/Pub related 38 | **/doc/api/ 39 | **/ios/Flutter/.last_build_id 40 | .flutter-plugins 41 | .flutter-plugins-dependencies 42 | .pub-cache/ 43 | /build/ 44 | 45 | # Web related 46 | lib/generated_plugin_registrant.dart 47 | 48 | # Symbolication related 49 | app.*.symbols 50 | 51 | # Obfuscation related 52 | app.*.map.json 53 | 54 | # Android Studio will place build artifacts here 55 | /android/app/debug 56 | /android/app/profile 57 | /android/app/release 58 | -------------------------------------------------------------------------------- /jwk/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.2.4 2 | * Improves documentation. 3 | 4 | ## 0.2.3 5 | * Raises Dart SDK minimum to 3.1.0. 6 | 7 | ## 0.2.2 8 | 9 | * Adds p256k support ([#135](https://github.com/dint-dev/cryptography/pull/135)). 10 | * Fixes a padding issue ([#134](https://github.com/dint-dev/cryptography/pull/134)). 11 | 12 | ## 0.2.1 13 | 14 | * Improves documentation. 15 | 16 | ## 0.2.0 17 | 18 | * Fixes various bugs. 19 | 20 | ## 0.1.1 21 | 22 | * Updates dependency constraints and linting rules. 23 | 24 | ## 0.1.0 25 | 26 | * Finishes null safety migration. 27 | 28 | ## 0.1.0-nullsafety.1 29 | 30 | * Fixes SDK and dependency constraints. 31 | 32 | ## 0.1.0-nullsafety.0 33 | 34 | * Initial version. -------------------------------------------------------------------------------- /jwk/README.md: -------------------------------------------------------------------------------- 1 | [![Pub Package](https://img.shields.io/pub/v/jwk.svg)](https://pub.dev/packages/jwk) 2 | [![Github Actions CI](https://github.com/dint-dev/cryptography/workflows/Dart%20CI/badge.svg)](https://github.com/dint-dev/cryptography/actions?query=workflow%3A%22Dart+CI%22) 3 | 4 | # Overview 5 | JWK (JSON Web Key) encoding and decoding. Designed to be used with 6 | [package:cryptography](https://pub.dev/packages/cryptography). 7 | 8 | Licensed under the [Apache License 2.0](LICENSE). 9 | 10 | # Getting started 11 | In _pubspec.yaml_ 12 | ```yaml 13 | dependencies: 14 | cryptography: ^2.7.0 15 | jwk: ^0.2.4 16 | ``` 17 | 18 | # Examples 19 | ## Encoding KeyPair 20 | ```dart 21 | import 'package:cryptography/cryptography.dart'; 22 | import 'package:jwk/jwk.dart'; 23 | 24 | Future main() async { 25 | final keyPair = await RsaPss().newKeyPair(); 26 | final jwk = Jwk.fromKeyPair(keyPair); 27 | final json = jwk.toJson(); 28 | } 29 | ``` 30 | 31 | ## Decoding SecretKey 32 | ```dart 33 | import 'package:jwk/jwk.dart'; 34 | 35 | void main() { 36 | final jwk = Jwk.fromJson({ 37 | 'kty': 'OCT', 38 | 'alg': 'A128KW', 39 | 'k': 'GawgguFyGrWKav7AX4VKUg', 40 | }); 41 | final secretKey = jwk.toSecretKey(); 42 | } 43 | ``` 44 | -------------------------------------------------------------------------------- /jwk/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml -------------------------------------------------------------------------------- /jwk/dart_test.yaml: -------------------------------------------------------------------------------- 1 | platforms: [ vm, chrome ] -------------------------------------------------------------------------------- /jwk/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: jwk 2 | version: 0.2.4 3 | homepage: https://github.com/dint-dev/cryptography 4 | description: JWK (JSON Web Key) encoding and decoding (for package:cryptography). 5 | 6 | environment: 7 | sdk: '>=3.1.0 <4.0.0' 8 | 9 | dependencies: 10 | collection: ^1.17.0 11 | cryptography: ^2.6.0 12 | 13 | dev_dependencies: 14 | lints: ^2.1.1 15 | test: ^1.24.0 16 | 17 | dependency_overrides: 18 | cryptography: 19 | path: ../cryptography --------------------------------------------------------------------------------