PowerBuilder
PowerBuilder
Examine the Contents of a .p7m by Converting to XML
Examines the contents of a .p7m signature by converting it to XML.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Asn
string ls_StrXml
oleobject loo_Xml
li_Success = 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Asn = create oleobject
li_rc = loo_Asn.ConnectToNewObject("Chilkat.Asn")
if li_rc < 0 then
destroy loo_Asn
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Asn.LoadBinaryFile("qa_data/p7m/a.p7m")
if li_Success <> 1 then
Write-Debug loo_Asn.LastErrorText
destroy loo_Asn
return
end if
// Convert to XML.
ls_StrXml = loo_Asn.AsnToXml()
// The XML returned by AsnToXml will be compact.
// To get the XML indented in human-readable form, load
// into the Chilkat XML object and emit..
loo_Xml = create oleobject
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")
loo_Xml.LoadXml(ls_StrXml)
Write-Debug loo_Xml.GetXml()
loo_Xml.SaveXml("qa_output/a.xml")
// -----------------------------------------------------------------------------------------
// Also see Chilkat's online tool to examine a .p7m and generate code to duplicate the .p7m
// -----------------------------------------------------------------------------------------
destroy loo_Asn
destroy loo_Xml