aes_gcm_crypto 0.0.1 copy "aes_gcm_crypto: ^0.0.1" to clipboard
aes_gcm_crypto: ^0.0.1 copied to clipboard

AES-GCM encryption and decryption utility with PBKDF2 key derivation support for Flutter apps.

🔐 aes_gcm_crypto - Cross-platform AES-256-GCM encryption/decryption for Flutter (Android, iOS, Web) #

pub package License: MIT


The aes_gcm_crypto plugin allows developers to perform AES-256 encryption and decryption using the GCM mode across Android, iOS, and Web. It uses platform-native cryptography APIs and secure WebCrypto to ensure high performance and security.


Features ✨ #

  • AES-256 GCM mode encryption and decryption
  • Platform-specific native implementations for Android and iOS
  • WebCrypto support for secure browser-based encryption
  • Simple, developer-friendly API
  • Supports UTF-8 strings as inputs/outputs

Installation 🚀 #

Add the package to your pubspec.yaml file:

dependencies:
  aes_gcm_crypto: ^0.0.1

Then, run:

flutter pub get

Platform Support ✅ #

Platform Support
Android
iOS
Web

Usage 🧑‍💻 #

1. Import the package #

import 'package:aes_gcm_crypto/aes_gcm_crypto.dart';

2. Encrypt #

final encrypted = await AesGcmCrypto.instance.encryptAesGcm(
  plainText: 'hello world',
  masterKey: '32_characters_secret_key_here',
);

3. Decrypt #

final decrypted = await AesGcmCrypto.instance.decryptAesGcm(
  cipherText: encrypted,
  masterKey: '32_characters_secret_key_here',
);

⚠️ Note: The masterKey must be exactly 32 characters (256-bit) long.


Example 📦 #

void main() async {
  const key = '12345678901234567890123456789012';
  const message = 'Encrypt me';

  final encrypted = await AesGcmCrypto.instance.encryptAesGcm(
    plainText: message,
    masterKey: key,
  );

  print('Encrypted: $encrypted');

  final decrypted = await AesGcmCrypto.instance.decryptAesGcm(
    cipherText: encrypted,
    masterKey: key,
  );

  print('Decrypted: $decrypted');
}

API Reference 📘 #

AesGcmCrypto #

Methods

  • encrypt({required String plainText, required String masterKey}): Encrypts a plain string using AES-256-GCM.
  • decrypt({required String cipherText, required String masterKey}): Decrypts the encrypted string back to plain text.

Best Practices 💡 #

  • Always store your master key securely (e.g., encrypted shared preferences, secure storage, or platform keychain).
  • Avoid hardcoding keys directly in the source.
  • Encrypt sensitive user or session data.

Permissions 📲 #

No special permissions are required to use this plugin.


License 📄 #

This plugin is licensed under the MIT License. See the LICENSE file for details.

0
likes
140
points
94
downloads

Publisher

unverified uploader

Weekly Downloads

AES-GCM encryption and decryption utility with PBKDF2 key derivation support for Flutter apps.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on aes_gcm_crypto