ninja
3.0.8, released 5 years ago by an unverified publisher
Cryptography library for Dart to encrypt, decrypt, sign, and verify messages using RSA and AES.
What it does
Provides cryptographic primitives for Dart and Flutter. It supports RSA encryption and decryption (OAEP, PKCS1v15), digital signatures (RSASSA-PSS, RSASSA-PKCS1-V1_5), key generation and PEM loading (PKCS#1 and PKCS#8), along with AES block cipher encryption.
AI-written summary of version 3.0.8, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to encrypt or decrypt data using RSA or AES in a Dart or Flutter application.
- You need to sign and verify messages with RSA signatures.
- You need to parse or generate PEM-formatted RSA keys.
Skip it when
- You need curve-based cryptography or advanced AES block cipher modes like GCM (marked as TODO in the library).
- You need a full suite of modern high-level cryptographic protocols beyond basic encryption/signatures.
Strengths
- Provides straightforward APIs for common RSA and AES operations.
- Supports loading keys from standard PEM formats (PKCS#1 and PKCS#8).
- Pure Dart implementation supporting multiple platforms (Android, iOS, Web, Windows, macOS, Linux).
Weaknesses
- Certain block cipher modes (GCM, ECB, CFB, OFB) and curve-based cryptography are currently missing or marked as TODO.
- Limited documentation outside of basic README snippets.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
No special native setup or build_runner required; just add the dependency to pubspec.yaml.
void main() {
final aes = AESKey(Uint8List.fromList(List.generate(16, (i) => i)));
String encoded = aes.encryptToBase64('Dart');
print(encoded);
String decoded = aes.decryptToUtf8(encoded);
print(decoded);
}Alternatives
Packages that do the same job and could replace ninja.
- webcrypto
Cross-platform implementation of Web Cryptography APIs for Dart.
89Compare - msgpack_dart
MessagePack implementation for Dart
50Compare - pkcs7
Parse, generate, and verify PKCS#7 messages and X509 certificates
50Compare - crypto_simple
Lightweight library for encrypting and decrypting strings with optional XOR and randomized modes.
41Compare
Works with
Packages commonly used together with ninja: ones it builds on, ones built on it, and its own family.