diff --git a/COPYING b/COPYING
index 99aa39815..8759d39dc 100644
--- a/COPYING
+++ b/COPYING
@@ -24,6 +24,15 @@ etc/schema/OpenDocument_manifest.rng
© 2002-2005 OASIS Open
© 1999-2005 Sun Microsystems, Inc.
+_______________________________________________________________________________
+etc/schema/OpenDocument_manifest_v1_2.rng
+
+ Open Document Format for Office Applications (OpenDocument) Version 1.2
+ OASIS Standard, 29 September 2011
+ Manifest Relax-NG Schema
+ Source: http://docs.oasis-open.org/office/v1.2/os/
+ Copyright (c) OASIS Open 2002-2011. All Rights Reserved.
+
_______________________________________________________________________________
src/minizip
diff --git a/etc/schema/OpenDocument_manifest_v1_2.xsd b/etc/schema/OpenDocument_manifest_v1_2.xsd
new file mode 100644
index 000000000..9e5e86374
--- /dev/null
+++ b/etc/schema/OpenDocument_manifest_v1_2.xsd
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ASiC_E.cpp b/src/ASiC_E.cpp
index 060f9671f..ea6ca0d05 100644
--- a/src/ASiC_E.cpp
+++ b/src/ASiC_E.cpp
@@ -28,6 +28,7 @@
#include "util/log.h"
#include "util/ZipSerialize.h"
#include "xml/OpenDocument_manifest.hxx"
+#include "xml/OpenDocument_manifest_v1_2.hxx"
#include "xml/SecureDOMParser.h"
#include
@@ -38,7 +39,6 @@
using namespace digidoc;
using namespace digidoc::util;
using namespace std;
-using namespace manifest;
const string ASiC_E::BES_PROFILE = "BES";
const string ASiC_E::EPES_PROFILE = "EPES";
@@ -149,7 +149,7 @@ void ASiC_E::addAdESSignature(istream &sigdata)
try
{
- addSignature(new SignatureXAdES_LTA(sigdata, this));
+ addSignature(make_unique(sigdata, this));
}
catch(const Exception &e)
{
@@ -179,14 +179,14 @@ void ASiC_E::createManifest(ostream &os)
try
{
- Manifest manifest;
- manifest.file_entry().push_back({"/", mediaType()});
+ manifest_1_2::Manifest manifest(manifest_1_2::Manifest::VersionType::cxx_1_2);
+ manifest.file_entry().push_back(make_unique("/", mediaType()));
for(const DataFile *file: dataFiles())
- manifest.file_entry().push_back({file->fileName(), file->mediaType()});
+ manifest.file_entry().push_back(make_unique(file->fileName(), file->mediaType()));
xml_schema::NamespaceInfomap map;
map["manifest"].name = ASiC_E::MANIFEST_NAMESPACE;
- manifest::manifest(os, manifest, map, {}, xml_schema::Flags::dont_initialize);
+ manifest_1_2::manifest(os, manifest, map, {}, xml_schema::Flags::dont_initialize);
if(os.fail())
THROW("Failed to create manifest XML");
}
@@ -234,11 +234,11 @@ void ASiC_E::parseManifestAndLoadFiles(const ZipSerialize &z)
p.schema_location(ASiC_E::MANIFEST_NAMESPACE,
File::fullPathUrl(Conf::instance()->xsdPath() + "/OpenDocument_manifest.xsd"));
unique_ptr doc = SecureDOMParser(p.schema_location(), true).parseIStream(manifestdata);
- unique_ptr manifest = manifest::manifest(*doc, {}, p);
+ unique_ptr manifest = manifest::manifest(*doc, {}, p);
set manifestFiles;
bool mimeFound = false;
- for(const File_entry &file: manifest->file_entry())
+ for(const manifest::File_entry &file: manifest->file_entry())
{
DEBUG("full_path = '%s', media_type = '%s'", file.full_path().c_str(), file.media_type().c_str());
@@ -289,7 +289,7 @@ void ASiC_E::parseManifestAndLoadFiles(const ZipSerialize &z)
{
stringstream data;
z.extract(file, data);
- addSignature(new SignatureXAdES_LTA(data, this, true));
+ addSignature(make_unique(data, this, true));
}
catch(const Exception &e)
{
@@ -351,9 +351,7 @@ Signature* ASiC_E::prepareSignature(Signer *signer)
THROW("No documents in container, can not sign container.");
if(!signer)
THROW("Null pointer in ASiC_E::sign");
- SignatureXAdES_LTA *signature = new SignatureXAdES_LTA(newSignatureId(), this, signer);
- addSignature(signature);
- return signature;
+ return addSignature(make_unique(newSignatureId(), this, signer));
}
Signature *ASiC_E::sign(Signer* signer)
diff --git a/src/ASiC_S.cpp b/src/ASiC_S.cpp
index 14f12bb3e..0c4767816 100644
--- a/src/ASiC_S.cpp
+++ b/src/ASiC_S.cpp
@@ -90,7 +90,7 @@ unique_ptr ASiC_S::openInternal(const string &path)
void ASiC_S::extractTimestamp(const ZipSerialize &z)
{
- addSignature(new SignatureTST(dataStream("META-INF/timestamp.tst", z), this));
+ addSignature(make_unique(dataStream("META-INF/timestamp.tst", z), this));
}
/**
diff --git a/src/ASiContainer.cpp b/src/ASiContainer.cpp
index 7792f11b6..be476a1f4 100644
--- a/src/ASiContainer.cpp
+++ b/src/ASiContainer.cpp
@@ -241,12 +241,12 @@ void ASiContainer::removeDataFile(unsigned int id)
d->documents.erase(it);
}
-void ASiContainer::addSignature(Signature *signature)
+Signature* ASiContainer::addSignature(unique_ptr &&signature)
{
- d->signatures.push_back(signature);
+ d->signatures.push_back(signature.release());
+ return d->signatures.back();
}
-
/**
* Removes signature from container by signature id.
*
diff --git a/src/ASiContainer.h b/src/ASiContainer.h
index a9680cff0..ddb422098 100644
--- a/src/ASiContainer.h
+++ b/src/ASiContainer.h
@@ -62,7 +62,7 @@ namespace digidoc
ASiContainer(const std::string &mimetype);
void addDataFilePrivate(std::unique_ptr is, const std::string &fileName, const std::string &mediaType);
- void addSignature(Signature *signature);
+ Signature* addSignature(std::unique_ptr &&signature);
std::unique_ptr dataStream(const std::string &path, const ZipSerialize &z) const;
std::unique_ptr load(const std::string &path, bool requireMimetype, const std::set &supported);
void deleteSignature(Signature* s);
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 80bdab1ab..e1581be78 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,6 +19,9 @@ XSD_SCHEMA( xsd_SRCS IGNORE ${XML_DIR} ${SCHEMA_DIR}/conf.xsd
XSD_SCHEMA( xsd_SRCS IGNORE ${XML_DIR} ${SCHEMA_DIR}/OpenDocument_manifest.xsd
--root-element manifest
--namespace-map urn:oasis:names:tc:opendocument:xmlns:manifest:1.0=digidoc::manifest )
+XSD_SCHEMA( xsd_SRCS IGNORE ${XML_DIR} ${SCHEMA_DIR}/OpenDocument_manifest_v1_2.xsd
+ --root-element manifest
+ --namespace-map urn:oasis:names:tc:opendocument:xmlns:manifest:1.0=digidoc::manifest_1_2 )
XSD_SCHEMA( xsd_SRCS XML_HEADER ${XML_DIR} ${SCHEMA_DIR}/xmldsig-core-schema.xsd
--root-element-none
--namespace-map http://www.w3.org/2000/09/xmldsig\#=digidoc::dsig
@@ -106,6 +109,7 @@ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tslcerts.h "};")
set( SCHEMA_FILES
${SCHEMA_DIR}/conf.xsd
${SCHEMA_DIR}/OpenDocument_manifest.xsd
+ ${SCHEMA_DIR}/OpenDocument_manifest_v1_2.xsd
${SCHEMA_DIR}/xmldsig-core-schema.xsd
${SCHEMA_DIR}/XAdES01903v132-201601.xsd
${SCHEMA_DIR}/XAdES01903v132-201601-relaxed.xsd