cryptography_flutter 2.3.2 copy "cryptography_flutter: ^2.3.2" to clipboard
cryptography_flutter: ^2.3.2 copied to clipboard

Makes 'package:cryptography' use platform APIs in Android, iOS, and Mac OS X. The package can make performance up to 100 times better.

Pub Package Github Actions CI

Overview #

This is a Flutter plugin that enables pub-web.flutter-io.cn/packages/cryptography to use native APIs of Android, iOS, and Mac OS X.

Maintained by gohilla.com. Licensed under the Apache License 2.0.

Why? #

  • Secure
    • Operating system APIs are preferable from security point of view.
  • Performant.
    • Operating system APIs are up to 100 times faster than pure Dart implementations.
  • Cross-platform.
    • The implementations fall back to "package:cryptography" implementations when operating system APIs can't be used.

General behavior #

The package is tested with cryptography_test.

This package contains two kinds of classes:

  • Classes such as FlutterChacha20 use operating system APIs in Android / iOS / Mac OS X. If the operating system does not support the algorithm, the background implementation (such as BackgroundChacha20) or a pure Dart implementation (such as DartChacha20) when available.
  • Classes such as BackgroundChacha20 move lengthy computations to a background isolate by using compute function in Flutter SDK.
  • Both compute very small inputs in the same isolate if the overhead of message passing does not make sense. For example, if you encrypt a 16 byte message, the computation is done in the same isolate.
  • Too large inputs are also computed in the same isolate (because you probably should not allocate a gigabyte cross-isolate message on a mobile phone).
  • We also have a queue to prevent memory exhaustion that could happen if you send lots of requests concurrently.

Getting started #

In pubspec.yaml:

dependencies:
  cryptography: ^2.7.0
  cryptography_flutter: ^2.3.2

That's it!

For API documentation, read more at pub-web.flutter-io.cn/packages/cryptography.

Behavior by algorithm #

AES-GCM #

FlutterAesGcm is used in Android, iOS, and Mac OS X. Our benchmarks have shown up to ~50 times better performance than DartAesGcm (the pure Dart implementation).

BackgroundAesGcm is used in Windows and Linux for inputs that are large enough.

ChaCha20-Poly1305-AEAD #

FlutterChacha20 is available for Android and Apple operating systems. Our benchmarks have shown up to ~50 times better performance than DartChacha20 (the pure Dart implementation).

BackgroundChacha20 is used in Windows and Linux for inputs that are large enough.

NIST ECDH / ECDSA #

FlutterEcdh and FlutterEcdsa are available for Apple operating systems.

Ed25519 #

FlutterEd25519 and BackgroundEd25519 are available for Apple operating systems.

X25519 #

FlutterX25519 and BackgroundX25519 are available for Apple operating systems.

HMAC #

FlutterHmac is available for Android..

PBKDF2 #

FlutterPbkdf2 is available for Android. BackgroundPbkdf2 is used in Apple operating systems, Windows and Linux.

29
likes
140
pub points
95%
popularity

Publisher

verified publisherdint.dev

Makes 'package:cryptography' use platform APIs in Android, iOS, and Mac OS X. The package can make performance up to 100 times better.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

cryptography, flutter

More

Packages that depend on cryptography_flutter