Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  final cert = CkCert();

  final strPem = '-----BEGIN CERTIFICATE----- ...';

  try {
    cert.loadPem(strPem);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  final pubKey = CkPublicKey();
  cert.getPublicKey(pubKey);

  // You can now use the public key object however it is needed,
  // and access its various properties and methods..

  print(pubKey.getXml());
}