flutter_cipher 0.0.3
flutter_cipher: ^0.0.3 copied to clipboard

A new Flutter Cipher package.

flutter_cipher #

一个Flutter加密类库 A Flutter encryption class library

Getting Started #

兼容iOS和Android Compatible with iOS and Android

RSA: 密钥格式: PKCS#1 Key format: PKCS#1

案例: example:

Asymmetric rsa = Cipher.getAsymmetricInstance(RSA(publicKey: publicKey, privateKey: privateKey));

var encryptPublic = rsa.encryptPublic(content);
var encryptPrivate = rsa.encryptPrivate(content);

var decryptPublic = rsa.decryptPublic(encryptPrivate);
var decryptPrivate = rsa.decryptPrivate(encryptPublic);


案例: example:

Key key = Key.fromUtf8('32 length key................');
IV iv = IV.fromLength(16);

Symmetry aes = Cipher.getSymmetryInstance(AES(key, iv)));

var encrypted = aes.encrypt(bytes);
var encrypted = aes.encryptString(str);

var content = aes.decrypt(encrypted);
var content = aes.decrypt2String(encrypted);

Finally, we would like to thank leocavalcante, as the main content of this library is derived from the encrypt library.