Sample code for 30+ languages & platforms
Dart

Convert DSA Public Key DER to PEM

See more DSA Examples

Converts a DSA public key from DER format to PEM.

Chilkat Dart Downloads

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

void main() {
  // This example requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final dsa = CkDsa();

  // Load a DER public key.
  try {
    dsa.fromPublicDerFile('dsa_pub.der');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Save the public key to PEM:
  final pemStr = dsa.toPublicPem();
  try {
    dsa.saveText(pemStr, 'dsa_pub.pem');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print('Finished!');
}