Dart
Dart
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Dart Downloads
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 PEM public key.
final pemPublicKey = dsa.loadText('dsa_pub.pem');
// Import the public key PEM into the DSA object.
try {
dsa.fromPublicPem(pemPublicKey);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Write it out as a DER file:
try {
dsa.toPublicDerFile('dsa_pub.der');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
print('Finished!');
}