From ec84f9ec53fc1c8764d3dd1bb587571deff51819 Mon Sep 17 00:00:00 2001 From: ferbas Date: Thu, 14 Jan 2010 09:59:17 +0000 Subject: improved mutli signature handling (url-map) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@548 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../sources/PDF-AS.SigHandler.cpp | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'Adobe_SigHandler') diff --git a/Adobe_SigHandler/Adobe.PDF-AS-SigHandler/sources/PDF-AS.SigHandler.cpp b/Adobe_SigHandler/Adobe.PDF-AS-SigHandler/sources/PDF-AS.SigHandler.cpp index b0e7b81..7c4c4ff 100644 --- a/Adobe_SigHandler/Adobe.PDF-AS-SigHandler/sources/PDF-AS.SigHandler.cpp +++ b/Adobe_SigHandler/Adobe.PDF-AS-SigHandler/sources/PDF-AS.SigHandler.cpp @@ -8,7 +8,7 @@ #include "FormsHFT.h" #include #include - +#include using namespace std; @@ -19,9 +19,10 @@ HFT gPubSecHFT = NULL; boolean gSigHandlerInitialized = false; clock_t openStamp = 0; clock_t validatedStamp = 0; +map verifyUrls; #define OPEN_INTERVAL 2000 // ms. no validation after document was opened -#define VALID_INTERVAL 5000 // ms. no multi signature validation +#define VALID_INTERVAL 6000 // ms. no multi signature validation /*------------------------------------------------------- Custom validation Callbacks @@ -48,9 +49,9 @@ static ACCBPROTO1 DSValidState ACCBPROTO2 DSValidateSig(PDDoc pdDoc, CosObj sigF } long validateDif = clock() - validatedStamp; - if (validateDif < VALID_INTERVAL) { - return DSSigValid; - } + //if (validateDif < VALID_INTERVAL) { + // return DSSigValid; + //} CosObj sigEntry = CosDictGet(sigAnnot, ASAtomFromString("V")); CosObj urlObj = CosDictGet(sigEntry, ASAtomFromString("ContactInfo")); @@ -60,6 +61,19 @@ static ACCBPROTO1 DSValidState ACCBPROTO2 DSValidateSig(PDDoc pdDoc, CosObj sigF urlStr = CosStringValue(urlObj, &len ); } + if (validateDif < VALID_INTERVAL) { + // multi sig verify + //string ustr (urlStr); + if (verifyUrls.find(urlStr) == verifyUrls.end()) { + verifyUrls[urlStr] = true; + } else { + return DSSigValid; + } + } else { + verifyUrls.clear(); + verifyUrls[urlStr]; + } + char msg[1024]; sprintf(msg, "Dieses Dokument enthält PDF-AS Signaturen. Wollen Sie diese unter %s verifizieren?", urlStr); -- cgit v1.2.3