Sample code for 30+ languages & platforms
PowerBuilder

Get JSON Details from the Last PFX Operation

See more PFX/P12 Examples

Demonstrates Pfx.GetLastJsonData, which replaces the contents of a JsonObject with structured JSON information from the most recent operation.

The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.

Tip: Code to parse the returned JSON can be generated with Chilkat's online tool at https://tools.chilkat.io/jsonParse.

Background. The data is copied as a complete replacement and is never merged with existing members. The exact members depend on the operation that produced them.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Pfx
string ls_Password
oleobject loo_Json
string ls_JsonStr

li_Success = 0

loo_Pfx = create oleobject
li_rc = loo_Pfx.ConnectToNewObject("Chilkat.Pfx")
if li_rc < 0 then
    destroy loo_Pfx
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  The file path is relative to the application's current working directory.  An absolute path
//  may also be used.  Supply the path appropriate to your own environment.
//  The PFX password should come from a secure source rather than being hard-coded.
ls_Password = "myPfxPassword"
li_Success = loo_Pfx.LoadPfxFile("qa_data/identity.pfx",ls_Password)
if li_Success = 0 then
    Write-Debug loo_Pfx.LastErrorText
    destroy loo_Pfx
    return
end if

//  Copy structured JSON information from the most recent operation into a JsonObject.  The contents
//  entirely replace anything already in the object.
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Pfx.GetLastJsonData(loo_Json)

loo_Json.EmitCompact = 0
ls_JsonStr = loo_Json.Emit()
Write-Debug ls_JsonStr
//  JSON parsing code for this result can be generated at Chilkat's online tool:
//  https://tools.chilkat.io/jsonParse


destroy loo_Pfx
destroy loo_Json