Dart Requires Chilkat v11.0.0+
Dart
Get Base64 Public Key from Private Key
See more ECC Examples
Demonstrates how to get the public key in base64 format from a private key.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// Load a private key from base64.
final bd = CkBinData();
bd.appendEncoded('MHQCA....n0Q==', 'base64');
final privKey = CkPrivateKey();
try {
privKey.loadAnyFormat(bd, '');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final pubKey = CkPublicKey();
privKey.toPublicKey(pubKey);
final pubKeyBase64 = pubKey.getEncoded(true, 'base64');
print(pubKeyBase64);
}