Sample code for 30+ languages & platforms
PowerBuilder

Extract XML string from a .p7m byte array (e.g. FATTURA ELETTRONICA, ITALY)

See more Digital Signatures Examples

_LANGUAGE_ example to extract the original XML from a .p7m (Signed-Data PKCS7 Format) provided as a byte array.

One use for this example is to extract the original XML from a Fattura Elettronica .p7m signature.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Fac
oleobject loo_Crypt
string ls_OriginalXml

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

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

loo_P7mBytes = loo_Fac.ReadEntireFile("testData/p7m/fattura_signature.p7m")
if loo_Fac.LastMethodSuccess <> 1 then
    Write-Debug loo_Fac.LastErrorText
    destroy loo_Fac
    return
end if

loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")

ls_OriginalXml = loo_Crypt.OpaqueVerifyString(loo_P7mBytes)
if loo_Crypt.LastMethodSuccess <> 1 then
    Write-Debug loo_Fac.LastErrorText
    destroy loo_Fac
    destroy loo_Crypt
    return
end if

Write-Debug "Original XML:"
Write-Debug ls_OriginalXml

Write-Debug "Success!"


destroy loo_Fac
destroy loo_Crypt