(DataFlex) Convert DSA Public Key DER to PEM
Converts a DSA public key from DER format to PEM.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoDsa
Boolean iSuccess
String sPemStr
String sTemp1
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatDsa)) To hoDsa
If (Not(IsComObjectCreated(hoDsa))) Begin
Send CreateComObject of hoDsa
End
// Load a DER public key.
Get ComFromPublicDerFile Of hoDsa "dsa_pub.der" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoDsa To sTemp1
Showln sTemp1
Procedure_Return
End
// Save the public key to PEM:
Get ComToPublicPem Of hoDsa To sPemStr
Get ComSaveText Of hoDsa sPemStr "dsa_pub.pem" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoDsa To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Finished!"
End_Procedure
|