Sample code for 30+ languages & platforms
PowerShell

DSA Public Key PEM to DER Conversion

See more DSA Examples

Converts a DSA public key from PEM format to DER.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$dsa = New-Object Chilkat.Dsa

# Load a PEM public key.

$pemPublicKey = $dsa.LoadText("dsa_pub.pem")
# Import the public key PEM into the DSA object.
$success = $dsa.FromPublicPem($pemPublicKey)
if ($success -ne $true) {
    $($dsa.LastErrorText)
    exit
}

# Write it out as a DER file:
$success = $dsa.ToPublicDerFile("dsa_pub.der")
if ($success -ne $true) {
    $($dsa.LastErrorText)
    exit
}

$("Finished!")