Perl
Perl
Convert DSA Public Key DER to PEM
See more DSA Examples
Converts a DSA public key from DER format to PEM.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $dsa = Chilkat2::Dsa->new;
# Load a DER public key.
my $success = $dsa->FromPublicDerFile('dsa_pub.der');
if (!$success) {
print $dsa->LastErrorText, "\n";
exit;
}
# Save the public key to PEM:
my $pemStr = $dsa->ToPublicPem();
$success = $dsa->SaveText($pemStr, 'dsa_pub.pem');
if (!$success) {
print $dsa->LastErrorText, "\n";
exit;
}
print "Finished!\n";