GithubHelp home page GithubHelp logo

windowsnt / ades Goto Github PK

View Code? Open in Web Editor NEW
34.0 7.0 17.0 1.33 MB

An Implementation of CAdES, XAdES, PAdES and ASiC for Windows in C++

License: MIT License

C++ 53.65% C 46.33% Batchfile 0.02%
pdf xml cades xades pades mime asic etsi eidas

ades's Introduction

AdES

A C++ library for Windows to create CAdES (B,T,C,X,XL), XAdES (B-T,C,X,XL) and PAdES (B-B,B-T,B-XL) messages. Also supports ASiC-S and ASiC-E with both CAdES and XAdES. 100% ETSI Compliant. Article at CodeProject: https://www.codeproject.com/Articles/1256991/AdES-An-implementation-of-CAdES-for-Windows-in-Cpl

CAdES

Quick guide:

HRESULT Sign(LEVEL lev,const char* data,DWORD sz,const std::vector<CERT>& Certificates, SIGNPARAMETERS& Params,std::vector<char>& Signature);
HRESULT Verify(const char* data, DWORD sz, LEVEL& lev,const char* omsg = 0,DWORD len = 0,std::vector<char>* msg = 0,std::vector<PCCERT_CONTEXT>* Certs = 0,VERIFYRESULTS* vr = 0);

Where

  • lev, enumeration from LEVEL: CMS,B,T,C,X or XL
  • data/sz, the data to sign
  • Certificates, a list of certificates to use for signing. Each CERT contains the certificate, CRLs, and more validation certificates
  • Params, additional parameters, including timestamp server, policy, commitment type, attach method etc.

In Verify()

  • data/sz, the signature to verify
  • lev, gets the detected level
  • omsg/len, the original data if the signature was detached
  • msg/certs/results, returned message, certificates used, and other data (policy, commitment type etc)

XAdES

Quick guide:

struct FILEREF
{
	const char* data = 0; // pointer to data
	DWORD sz = 0; // size, or 0 if null terminated XML
	const char* ref = 0;
	std::string mime = "application/octet-stream";
};
HRESULT XMLSign(LEVEL lev, std::vector<FILEREF>& data,const std::vector<CERT>& Certificates,SIGNPARAMETERS& Params, std::vector<char>& Signature);

// Currently XMLDSIG only
HRESULT XMLVerify(const char* xmldata, LEVEL& lev, ATTACHTYPE& att, const char* omsg, DWORD len, bool WasDetachedCanonicalized,std::vector<PCCERT_CONTEXT> * Certs, VERIFYRESULTS * vr);

PAdES

Quick guide:

HRESULT PDFSign(LEVEL lev,const char* data,DWORD sz,const std::vector<CERT>& Certificates, SIGNPARAMETERS& Params,std::vector<char>& Signature);

ASiC

Quick guide:

HRESULT ASiC(ALEVEL alev,ATYPE typ, LEVEL lev,std::vector<FILEREF>& data,std::vector<CERT>& Certificates, SIGNPARAMETERS& Params, std::vector<char>& fndata);

EXE

Quick guide:

HRESULT PESign(LEVEL lev,const char* data,DWORD sz,const std::vector<CERT>& Certificates, SIGNPARAMETERS& Params,std::vector<char>& Signature);

ades's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ades's Issues

"No contents in first page" error when signing PDF with "Visible" parameters

Hello.
First of all, thank you for this useful library. I'm having trouble signing a PDF file with visible parameters. I get the error "No contents in first page". The PDF I'm trying to sign is the following: https://cs.stanford.edu/~jure/pubs/node2vec-kdd16.pdf
The "Visible" signing parameters in use are the following (actually, I've tried many combinations, even the default ones, with no avail, so they might not be relevant):

Params.pdfparams.Visible.top = 10;
Params.pdfparams.Visible.left = 10;
Params.pdfparams.Visible.wi = 10;
Params.pdfparams.Visible.fs = 10;
Params.pdfparams.Visible.t = "test";

This is the first PDF I've had this error with so far. It works on other files.
Can you please help me with this problem?
Regards,
Aleksandar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.