toPem method

String toPem()

A PEM bundle of anchors with provenance headers - what PdfAatlSnapshot.fromPem and PdfTrustStore.addPem read.

Implementation

String toPem() {
  final out = StringBuffer('# Adobe Approved Trust List anchors\n');
  if (signedAt != null) {
    out.writeln('# signed: ${signedAt!.toUtc().toIso8601String()}');
  }
  if (signer != null) out.writeln('# signer: $signer');
  if (fetchedAt != null) {
    out.writeln('# fetched-at: ${fetchedAt!.toUtc().toIso8601String()}');
  }
  for (final der in anchors) {
    out.write(pemEncode('CERTIFICATE', der));
  }
  return out.toString();
}