Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

/** NSS signature generator
 * Mozilla has two APIs for generating signatures (older SEC_PKCS7)
 * and newer SMIME (CMS). We are using newer API. 
 * You have to have certificate (CERTCertificate * )which will be 
 * used for signing.


#include <cms.h>
#include <cert.h>
#include <secoid.h>
#include <string>

#include "SignatureGenerator.h"

namespace PoDoFo {
    class PdfData;

00024 class NSSSignatureGenerator : public SignatureGenerator
    PoDoFo::PdfData *pSignature;
      CERTCertificate *pCert;
      NSSCMSMessage *cmsg;
      NSSCMSEncoderContext *enc;
      std::string signature;

      static void sm_write_stream(void *arg, const char *buf, unsigned long len);

    // get digest algoritm for the signing algoritm
      static SECOidTag getDigestAlgor(CERTCertificate *pCert);

      // create message with signature
      static NSSCMSMessage *createSign(CERTCertificate *cert);

      NSSSignatureGenerator(CERTCertificate *pCert);
      virtual ~NSSSignatureGenerator();

      virtual bool init();

      virtual bool appendData(const char *pData, unsigned int dataSize);
    virtual bool finishData();
    virtual const PoDoFo::PdfData *getSignature();


Generated by  Doxygen 1.6.0   Back to index