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

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat Dart Downloads

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

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

  try {
    cert.loadFromFile('qa_data/pem/my_cert.pem');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

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

  // Examine the public key as XML..
  print(pubkey.getXml());
}