sm2cipher 0.0.9
sm2cipher: ^0.0.9 copied to clipboard
Encrypt and decrypt data use SM2, This is the High level API build amount pointycastle, specify Elliptic curve to SM2 can simplify the api.
example/main.dart
import 'package:sm2cipher/src/sm2Cipher.dart' as prefix0;
void main() {
final kp = prefix0.generateKeyPair();
// print('private: ${prefix0.strinifyPrivateKey(kp.privateKey)}');
// print('public: ${prefix0.strinifyPublicKey(kp.publicKey)}');
final serverPub =
'02e13005599b039d914b6e2b5835c93f80874c931ceca77b920621e22bab623757';
final enc = prefix0.pubkeyEncrypt(
prefix0.strinifyPrivateKey(kp.privateKey), serverPub, "test test");
print(enc);
print('pub: ${prefix0.strinifyPublicKey(kp.publicKey)}');
}