summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/gpgv.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-03-18 19:36:55 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-03-18 19:36:55 +0100
commitf1828b6977972b4ef6da6401602b7938f6570c32 (patch)
treec04aa9cbd30e7ee4152f408ee13f663e332b7327 /apt-pkg/contrib/gpgv.h
parent34747d46be3a15105d896266d8043f55d04e7735 (diff)
- add method to open (maybe) clearsigned files transparently
* ftparchive/writer.cc: - use OpenMaybeClearSignedFile to be free from detecting and skipping clearsigning metadata in dsc files
Diffstat (limited to 'apt-pkg/contrib/gpgv.h')
-rw-r--r--apt-pkg/contrib/gpgv.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h
index 8e04855e4..ab7d35ab1 100644
--- a/apt-pkg/contrib/gpgv.h
+++ b/apt-pkg/contrib/gpgv.h
@@ -12,6 +12,8 @@
#include <string>
#include <vector>
+#include <apt-pkg/fileutl.h>
+
#if __GNUC__ >= 4
#define APT_noreturn __attribute__ ((noreturn))
#else
@@ -52,10 +54,17 @@ inline void ExecGPGV(std::string const &File, std::string const &FileSig,
* The code doesn't support dash-encoded lines as these are not
* expected to be present in files we have to deal with.
*
+ * The content of the split files is undefined if the splitting was
+ * unsuccessful.
+ *
+ * Note that trying to split an unsigned file will fail, but
+ * not generate an error message.
+ *
* @param InFile is the clear-signed file
* @param ContentFile is the Fd the message will be written to
* @param ContentHeader is a list of all required Amored Headers for the message
* @param SignatureFile is the Fd all signatures will be written to
+ * @return true if the splitting was successful, false otherwise
*/
bool SplitClearSignedFile(std::string const &InFile, int const ContentFile,
std::vector<std::string> * const ContentHeader, int const SignatureFile);
@@ -74,4 +83,17 @@ bool SplitClearSignedFile(std::string const &InFile, int const ContentFile,
bool RecombineToClearSignedFile(std::string const &OutFile, int const ContentFile,
std::vector<std::string> const &ContentHeader, int const SignatureFile);
+/** \brief open a file which might be clear-signed
+ *
+ * This method tries to extract the (signed) message of a file.
+ * If the file isn't signed it will just open the given filename.
+ * Otherwise the message is extracted to a temporary file which
+ * will be opened instead.
+ *
+ * @param ClearSignedFileName is the name of the file to open
+ * @param[out] MessageFile is the FileFd in which the file will be opened
+ * @return true if opening was successful, otherwise false
+ */
+bool OpenMaybeClearSignedFile(std::string const &ClearSignedFileName, FileFd &MessageFile);
+
#endif