secp256k1cipher 0.1.0 copy "secp256k1cipher: ^0.1.0" to clipboard
secp256k1cipher: ^0.1.0 copied to clipboard

outdated

Encrypt and decrypt data use secp256k1, This is the High level API build amount pointycastle, specify Elliptic curve to secp256k1 can simplify the api, and output base64 string for easy transfer on internet.

example/main.dart

import 'package:secp256k1cipher/secp256k1cipher.dart';

void main(){
  var alic = generateKeyPair(); // Create Alic keypair
  var bob = generateKeyPair();  // Create Bob keypair
  var raw_str = 'Encrypt and decrypt data use secp256k1';  // This is what alic want to say to bob
  var enc_map = pubkeyEncrypt(strinifyPrivateKey(alic.privateKey), strinifyPublicKey(bob.publicKey), raw_str); // use alic's privatekey and bob's publickey means alic say to bob
  var enc_str = enc_map['enc']; // Get encrypted base64 string
  var iv = enc_map['iv'];       // Get random IV
  // next thing, you can send enc_str and IV via internet to bob
  var decryptd = privateDecrypt(strinifyPrivateKey(bob.privateKey), strinifyPublicKey(alic.publicKey), enc_str, iv); // use bob's privatekey and alic's publickey means bob can read message from alic
  print('alic say:${decryptd}');
}
8
likes
0
pub points
61%
popularity

Publisher

unverified uploader

Encrypt and decrypt data use secp256k1, This is the High level API build amount pointycastle, specify Elliptic curve to secp256k1 can simplify the api, and output base64 string for easy transfer on internet.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

pointycastle

More

Packages that depend on secp256k1cipher