(DataFlex) DSA Public Key PEM to DER Conversion
Converts a DSA public key from PEM format to DER.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoDsa
String sPemPublicKey
Boolean iSuccess
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 PEM public key.
Get ComLoadText Of hoDsa "dsa_pub.pem" To sPemPublicKey
// Import the public key PEM into the DSA object.
Get ComFromPublicPem Of hoDsa sPemPublicKey To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoDsa To sTemp1
Showln sTemp1
Procedure_Return
End
// Write it out as a DER file:
Get ComToPublicDerFile Of hoDsa "dsa_pub.der" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoDsa To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Finished!"
End_Procedure
|