Skip to content

Commit

Permalink
try to convert remaining calls
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Jun 16, 2024
1 parent e80dc78 commit 1f68f04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion libs/pkcs11/src/Sign/CIEVerify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ long CIEVerify::verify(const char* input_file, VERIFY_RESULT* verifyResult,

long ret;
ctx = disigon_verify_init();

#if 1

ret = disigon_set(DISIGON_OPT_LOG_LEVEL, (void*)LOG_TYPE_DEBUG);
Expand Down Expand Up @@ -65,11 +64,13 @@ long CIEVerify::verify(const char* input_file, VERIFY_RESULT* verifyResult,
}

ret = disigon_verify_verify(ctx, verifyResult);
printf("disigon_verify_verify");
if (ret != 0) {
throw ret;
}

ret = disigon_verify_cleanup(ctx);
printf("disigon_verify_cleanup");
if (ret != 0) {
throw ret;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/sign-sdk/include/PdfVerifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PDFVerifier {

virtual ~PDFVerifier();

int Load(const char* pdf, int len);
int Load(bufferview *pdf, int len);
int Load(const char* szFilePath);

int GetNumberOfSignatures();
Expand Down
9 changes: 6 additions & 3 deletions libs/sign-sdk/src/PdfVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*
*/

#include <cstdio>
#include <iterator>

#include "auxiliary/basetypes.h"
#include "main/PdfTrailer.h"
#ifndef HP_UX

Expand All @@ -29,15 +33,14 @@ PDFVerifier::~PDFVerifier() {
if (m_pPdfMemDocument) delete m_pPdfMemDocument;
}

int PDFVerifier::Load(const char *pdf, int len) {
int PDFVerifier::Load(bufferview *pdf, int len) {
if (m_pPdfMemDocument) delete m_pPdfMemDocument;

try {
m_pPdfMemDocument = new PdfMemDocument();
m_pPdfMemDocument->Load(pdf);
m_pPdfMemDocument->LoadFromBuffer(*pdf);
m_actualLen = len;
m_szDocBuffer = (char *)pdf;

return 0;
} catch (::PoDoFo::PdfError &err) {
return -2;
Expand Down
2 changes: 1 addition & 1 deletion libs/sign-sdk/src/disigonsdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,7 @@ long verify_pdf(DISIGON_VERIFY_CONTEXT* pContext, UUCByteArray& data,
VERIFY_INFO* pVerifyInfo) {
PDFVerifier pdfVerifier;

long nRes = pdfVerifier.Load((char*)data.getContent(), data.getLength());
long nRes = pdfVerifier.Load((bufferview*)data.getContent(), data.getLength());

if (nRes) {
LOG_ERR((0, "<-- verify_pdf", "Context: %p, Error: %x", pContext, nRes));
Expand Down

0 comments on commit 1f68f04

Please sign in to comment.