Sample code for 30+ languages & platforms
React Native

DSA Public Key PEM to DER Conversion

See more DSA Examples

Converts a DSA public key from PEM format to DER.

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 PEM public key.
  const pemPublicKey = dsa.loadText('dsa_pub.pem');
  // Import the public key PEM into the DSA object.
  try {
    dsa.fromPublicPem(pemPublicKey);
  } catch {
    console.log(dsa.lastErrorText);
    return;
  }

  // Write it out as a DER file:
  try {
    dsa.toPublicDerFile('dsa_pub.der');
  } catch {
    console.log(dsa.lastErrorText);
    return;
  }

  console.log('Finished!');
}