Java
Chilkat2 Java
Extract XML File from a .p7m (e.g. FATTURA ELETTRONICA, ITALY)
See more Digital Signatures Examples
_LANGUAGE_ example to extract the original file from a .p7m (Signed-Data PKCS7 Format) The .p7m contains the signed contents of the original file.One use for this example is to extract the XML file from a Fattura Elettronica .p7m signature.
Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Crypt2;
public class ChilkatExample {
public static void main(String[] args) {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Crypt2 crypt = new Crypt2();
String outputFile = "testData/xml/original.xml";
String inFile = "testData/p7m/fattura_signature.p7m";
// Verify the signature and extract the XML file.
try {
crypt.verifyP7M(inFile, outputFile);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("Success!");
}
}