Sample code for 30+ languages & platforms
Visual FoxPro

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 Visual FoxPro Downloads

Visual FoxPro
LOCAL loFac
LOCAL loP7mBytes
LOCAL loCrypt
LOCAL lcOriginalXml

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

loFac = CreateObject('Chilkat.FileAccess')

loP7mBytes = loFac.ReadEntireFile("testData/p7m/fattura_signature.p7m")
IF (loFac.LastMethodSuccess <> 1) THEN
    ? loFac.LastErrorText
    RELEASE loFac
    CANCEL
ENDIF

loCrypt = CreateObject('Chilkat.Crypt2')

lcOriginalXml = loCrypt.OpaqueVerifyString(loP7mBytes)
IF (loCrypt.LastMethodSuccess <> 1) THEN
    ? loFac.LastErrorText
    RELEASE loFac
    RELEASE loCrypt
    CANCEL
ENDIF

? "Original XML:"
? lcOriginalXml

? "Success!"

RELEASE loFac
RELEASE loCrypt