Java
Chilkat2 Java
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Dsa;
public class ChilkatExample {
public static void main(String[] args) {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Dsa dsa = new Dsa();
// Load a PEM public key.
String pemPublicKey = dsa.loadText("dsa_pub.pem");
// Import the public key PEM into the DSA object.
try {
dsa.fromPublicPem(pemPublicKey);
// Write it out as a DER file:
dsa.toPublicDerFile("dsa_pub.der");
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("Finished!");
}
}