| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef _NSS_SIGNATURE_GENERATOR_H_ |
| 11 |
#define _NSS_SIGNATURE_GENERATOR_H_ |
| 12 |
|
| 13 |
#include <cms.h> |
| 14 |
#include <cert.h> |
| 15 |
#include <secoid.h> |
| 16 |
#include <string> |
| 17 |
|
| 18 |
#include "SignatureGenerator.h" |
| 19 |
|
| 20 |
namespace PoDoFo { |
| 21 |
class PdfData; |
| 22 |
}; |
| 23 |
|
| 24 |
class NSSSignatureGenerator : public SignatureGenerator |
| 25 |
{ |
| 26 |
private: |
| 27 |
PoDoFo::PdfData *pSignature; |
| 28 |
CERTCertificate *pCert; |
| 29 |
NSSCMSMessage *cmsg; |
| 30 |
NSSCMSEncoderContext *enc; |
| 31 |
std::string signature; |
| 32 |
|
| 33 |
static void sm_write_stream(void *arg, const char *buf, unsigned long len); |
| 34 |
|
| 35 |
protected: |
| 36 |
|
| 37 |
static SECOidTag getDigestAlgor(CERTCertificate *pCert); |
| 38 |
|
| 39 |
|
| 40 |
static NSSCMSMessage *createSign(CERTCertificate *cert); |
| 41 |
|
| 42 |
public: |
| 43 |
NSSSignatureGenerator(CERTCertificate *pCert); |
| 44 |
virtual ~NSSSignatureGenerator(); |
| 45 |
|
| 46 |
virtual bool init(); |
| 47 |
|
| 48 |
virtual bool appendData(const char *pData, unsigned int dataSize); |
| 49 |
virtual bool finishData(); |
| 50 |
virtual const PoDoFo::PdfData *getSignature(); |
| 51 |
}; |
| 52 |
|
| 53 |
#endif |