|
libdigidocpp 4.5.0
|
Offers functionality for handling data files and signatures in a container. More...
#include <Container.h>
Public Member Functions | |
| virtual | ~Container () |
| virtual void | save (const std::string &path="")=0 |
| virtual std::string | mediaType () const =0 |
| virtual void | addDataFile (const std::string &path, const std::string &mediaType)=0 |
| virtual DIGIDOCPP_DEPRECATED void | addDataFile (std::istream *is, const std::string &fileName, const std::string &mediaType) |
| virtual std::vector< DataFile * > | dataFiles () const =0 |
| virtual void | removeDataFile (unsigned int index)=0 |
| void | addAdESSignature (const std::vector< unsigned char > &signature) |
| virtual void | addAdESSignature (std::istream &signature)=0 |
| virtual Signature * | prepareSignature (Signer *signer)=0 |
| virtual std::vector< Signature * > | signatures () const =0 |
| virtual void | removeSignature (unsigned int index)=0 |
| virtual Signature * | sign (Signer *signer)=0 |
| virtual void | addDataFile (std::unique_ptr< std::istream > is, const std::string &fileName, const std::string &mediaType) |
Static Public Member Functions | |
| static DIGIDOCPP_DEPRECATED Container * | create (const std::string &path) |
| static std::unique_ptr< Container > | createPtr (const std::string &path) |
| static DIGIDOCPP_DEPRECATED Container * | open (const std::string &path) |
| static std::unique_ptr< Container > | openPtr (const std::string &path) |
| static std::unique_ptr< Container > | openPtr (const std::string &path, digidoc::ContainerOpenCB *cb) |
| template<class T > | |
| static void | addContainerImplementation () |
| static std::unique_ptr< Container > | extendContainerValidity (Container &doc, Signer *signer, size_t &extendedCount) |
Protected Member Functions | |
| virtual std::string | path () const |
| Container () | |
| unsigned int | newSignatureId () const |
Offers functionality for handling data files and signatures in a container.
Container can contain several files and all these files can be signed using signing certificates. Container can only be signed if it contains data files. data files can be added and removed from container only if the container is not signed. To add or remove data files from signed container remove all the signatures before modifying data files list in container.
|
virtualdefault |
Releases resources.
|
protecteddefault |
Create a new container object and specify the DigiDoc container type
| void Container::addAdESSignature | ( | const std::vector< unsigned char > & | signature | ) |
Adds signature to the container.
| signature | signature, which is added to the container. |
| Exception | throws exception if there are no data files in container. |
References addAdESSignature().
Referenced by addAdESSignature().
|
pure virtual |
Adds signature to the container.
| signature | signature, which is added to the container. |
| Exception | throws exception if there are no data files in container. |
|
static |
Adds container implementation
It must contain static members:
|
pure virtual |
Adds data file from file system to the container.
| path | a data file, which is added to the container. |
| mediaType | MIME type of the data file, for example “text/plain” or “application/msword” |
| Exception | exception is thrown if the data file path is incorrect or a data file with same file name already exists. Also, no data file can be added if the container already has one or more signatures. |
Referenced by addDataFile().
|
virtual |
Adds the data from an input stream (i.e. the data file contents can be read from internal memory buffer).
Takes ownership std::istream *is object.
| is | input stream from where data is read |
| fileName | data file name in the container |
| mediaType | MIME type of the data file, for example “text/plain” or “application/msword” |
| Exception | exception is thrown if the data file path is incorrect or a data file with same file name already exists. Also, no data file can be added if the container already has one or more signatures. |
References addDataFile(), and mediaType().
|
virtual |
Adds the data from an input stream (i.e. the data file contents can be read from internal memory buffer).
| is | input stream from where data is read |
| fileName | data file name in the container |
| mediaType | MIME type of the data file, for example “text/plain” or “application/msword” |
| Exception | exception is thrown if the data file path is incorrect or a data file with same file name already exists. Also, no data file can be added if the container already has one or more signatures. |
|
static |
Create a new container object and specify the DigiDoc container type
References createPtr(), and path().
Referenced by createPtr().
|
static |
|
pure virtual |
List of all the data files in the container
Container holds ownership of data files objects
|
static |
Extends the validity of signatures in the container by adding a new timestamp.
For ASiC-E and ASiC-S containers, considers only signatures whose signing certificate has country=EE; non-Estonian signatures are ignored when deciding whether extension is possible. For ASiC-E containers with valid LT-level EE signatures, extends eligible non-e-seal signatures in place by adding an archive timestamp. For ASiC-S containers, re-timestamps the existing EE timestamp token. If in-place extension is not possible, wraps the original container as a data file in a new ASiC-S container and adds a timestamp.
Containers where all considered EE signatures are T-level (time-stamp profile without OCSP) cannot be extended and will throw. Containers with no Estonian signing certificates will throw.
| doc | container whose signatures are to be extended. |
| signer | signer used to create the new timestamp; its profile will be set automatically. |
| extendedCount | set to the number of signatures extended in place; 0 if the container was wrapped. |
| Exception | if the container has no signatures, no EE signatures, all signatures are T-level, or extension fails. |
References digidoc::Exception::causes(), digidoc::Exception::CertificateIssuerMissing, digidoc::Exception::CertificateUnknown, mediaType(), digidoc::Exception::MimeTypeWarning, digidoc::Exception::OCSPCertMissing, digidoc::Exception::OCSPResponderMissing, path(), digidoc::X509Cert::QCT_ESEAL, digidoc::Signer::setProfile(), and signatures().
|
pure virtual |
Returns current data file format
Referenced by addDataFile(), and extendContainerValidity().
|
protected |
Returns unique signature id
References digidoc::Signature::id(), and signatures().
|
static |
Opens container from a file
This method gives ownership of object to caller
| path |
| Exception |
References openPtr(), and path().
Referenced by openPtr().
|
static |
|
static |
Opens container from a file
| path | |
| cb | Callback called when additional info is requested (digidoc::ContainerOpenCB::validateOnline) |
| Exception |
|
protectedvirtual |
Returns the path of the container.
Referenced by create(), createPtr(), extendContainerValidity(), open(), openPtr(), and openPtr().
|
pure virtual |
Prepares Signature object that can later signed.
Container holds ownership of Signature object
| signer | signer implementation. |
| Exception | exception is thrown if signing the container failed. |
|
pure virtual |
Removes data file from container by data file index. Data files can be removed from container only after all signatures are removed.
| index | data file's index, which will be removed. |
| Exception | throws exception if the data file id is incorrect or there are one or more signatures. |
|
pure virtual |
Removes signature from container by signature index.
| index | signature's index, which will be removed. |
| Exception | throws exception if the signature id is incorrect. |
|
pure virtual |
Saves the container.
| Exception | is thrown if there was a failure saving container. For example added data file does not exist. |
|
pure virtual |
|
pure virtual |
Returns list of all container's signatures.
Container holds ownership of signature objects
Referenced by extendContainerValidity(), and newSignatureId().