Skip to content

Commit

Permalink
first attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Nov 6, 2023
1 parent a5d4c40 commit 58ae70e
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 100 deletions.
26 changes: 23 additions & 3 deletions libs/sign-sdk/include/PdfSignatureGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#ifndef _PDFSIGNATUREGENERATOR_H_
#define _PDFSIGNATUREGENERATOR_H_

#include <podofo/auxiliary/InputStream.h>
#include <podofo/auxiliary/OutputDevice.h>
#include <podofo/auxiliary/OutputStream.h>
#include <podofo/auxiliary/Rect.h>
#include <podofo/main/PdfFontManager.h>
#include <podofo/main/PdfSignature.h>
#include <podofo/podofo.h>

#include "Util/UUCByteArray.h"
Expand All @@ -25,6 +31,10 @@ class PdfSignatureGenerator {

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

void AdjustByteRange(OutputStreamDevice& device, size_t byteRangeOffset,
size_t conentsBeaconOffset, size_t conentsBeaconSize,
charbuff& buffer);

void InitSignature(int pageIndex, const char* szReason,
const char* szReasonLabel, const char* szName,
const char* szNameLabel, const char* szLocation,
Expand All @@ -49,6 +59,14 @@ class PdfSignatureGenerator {

void GetBufferForSignature(UUCByteArray& toSign);

size_t ReadForSignature(StreamDevice& device, size_t conentsBeaconOffset,
size_t conentsBeaconSize, char* buffer, size_t size);

void SetGraphometricData(PdfSignature* pSignatureField,
nullable<const PdfString&> vendor,
nullable<const PdfString&> szGraphometricData,
nullable<const PdfString&> szVersion);

void SetSignature(const char* signature, int len);

void GetSignedPdf(UUCByteArray& signature);
Expand All @@ -60,17 +78,19 @@ class PdfSignatureGenerator {
const double getHeight(int pageIndex);

private:
PdfSignatureBeacons* m_beacons;

PdfDocument* m_pPdfDocument;

PdfMemDocument* m_pPdfMemDocument;

PdfWriter* m_pPdfWriter;

PdfSignatureField* m_pSignatureField;
PdfSignature* m_pSignatureField;

PdfSignOutputDevice* m_pSignOutputDevice;
StreamDevice* m_pSignOutputDevice;

PdfOutputDevice* m_pFinalOutDevice;
OutputStreamDevice* m_pFinalOutDevice;

char* m_pMainDocbuffer;

Expand Down
Loading

0 comments on commit 58ae70e

Please sign in to comment.