Sample code for 30+ languages & platforms
React Native

Convert DSA Public Key DER to PEM

See more DSA Examples

Converts a DSA public key from DER format to PEM.

Chilkat React Native Downloads

React Native
import { Dsa } from '@chilkat/react-native'

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

  const dsa = new Dsa();

  // Load a DER public key.
  try {
    dsa.fromPublicDerFile('dsa_pub.der');
  } catch {
    console.log(dsa.lastErrorText);
    return;
  }

  // Save the public key to PEM:
  const pemStr = dsa.toPublicPem();
  try {
    dsa.saveText(pemStr, 'dsa_pub.pem');
  } catch {
    console.log(dsa.lastErrorText);
    return;
  }

  console.log('Finished!');
}