def dump(self, directory=os.path.expanduser('~'), format=converter.types.GRT, extension=".bin"): """ Dump the ePassport content on disk as well ass the faces ans signatures in jpeg, the DG15 public key and the Document Signer Certificate. By default, the files are stored in the user directory (~) with the Golden Reader Tool naming format @param directory: The taget directory @param format: File naming format (see the convertion module) @param extension: File extension """ dgd = datagroup.DataGroupDump(directory, extension) dgd.dump(self, format) cpt = 0 for sig in self.getSignatures(): dgd.dumpData(sig, "signature" + str(cpt) + ".jpg") cpt += 1 cpt = 0 for face in self.getFaces(): dgd.dumpData(face, "face" + str(cpt) + ".jpg") cpt += 1 dgd.dumpData(self.getPublicKey(), "DG15PubKey.pk") dgd.dumpData(self.getCertificate(), "DocumentSigner.cer")
cscaKey = f.read() f.close() f = open(WORKING_DIR + "\\ds") ds = f.read() f.close() f = open(WORKING_DIR + "\\dsKey") dsKey = f.read() f.close() ca = pki.CA(csca=csca, cscaKey=cscaKey) ca.register(trace) else: ca = pki.CA() ca.register(trace) dgd = datagroup.DataGroupDump(WORKING_DIR) #Generate the CSCA Certificate and its private key in PEM (csca, cscaKey) = ca.createCSCA(CSCA_KEY_SIZE, CSCA_VALIDITY_PERIOD, CSCA) dgd.dumpData(csca, "csca") dgd.dumpData(cscaKey, "cscaKey") dgd.dumpData(o.x509ToDER(csca), "csca.cer") ##Generate the DS Certificate and its private key in PEM (ds, dsKey) = ca.createDS(DS_KEY_SIZE, DS_VALIDITY_PERIOD, DS) dgd.dumpData(ds, "ds") dgd.dumpData(dsKey, "dsKey") #Generate the CRL in DER crl = ca.getCrl() dgd.dumpData(crl, "csca.crl") if INSTALL_APPLET: