GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - thefinalcutbg/XML-Cpp-Signer-PKCS11: A simple C++ script for generating enveloped XAdES xml signatures using pkcs11

BranchesTags
Open more actions menu

Latest commit

 

History

37 Commits
37 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
PKCS11-XML-Signer.vcxproj
PKCS11-XML-Signer.vcxproj
 
 
PKCS11-XML-Signer.vcxproj.filters
PKCS11-XML-Signer.vcxproj.filters
 
 
README.md
README.md
 
 
XML Cpp Signer PKCS11.sln
XML Cpp Signer PKCS11.sln
 
 

Repository files navigation

XML Cpp Signer PKCS11

A simple C++17 script that creates enveloped XML signature using the PKCS11 interface. It supports XAdES BASELINE_B specification.

  • Verify XAdES at EC DSS or at https://verifysignature.eu
  • Verify XML DSig at Chilkat XML Verifier

Dependencies

  • OpenSsl
  • Libp11
  • LibXml2

Setup

Use the provided MS Visual Studio solution or setup the project by yourself. Provide the necessary includes and libs.

Example

#include <iostream>
#include "signer.h"
#include "pkcs11.h"

int main()
{
      std::string xml = R"xml(<?xml version="1.0"?><example>some data to sign</example>)xml";
     
      PKCS11::setMiddlewareFilePath({ "C:/Program Files/OpenSC Project/OpenSC/pkcs11/opensc-pkcs11.dll" });
     
      PKCS11 hsm;
     
      if (!hsm.hsmLoaded()) {
          std::cout << "no hsm found";
          return 0;
      }
     
      if (hsm.loginRequired()) {
     
          std::string password;

          std::cout << "Enter password: ";
          std::cin >> password;
     
          if (!hsm.login(password)) {
              std::cout << std::endl << "Wrong password!" << std::endl;
              return 0;
          }
      }
     
      bool signWithXAdES = true;
      std::cout << std::endl << Signer::signEnveloped(xml, hsm.takePrivateKey(), hsm.x509raw(), signWithXAdES);
     
      return 0;
}

License

This software is licensed under the MIT license.

About

A simple C++ script for generating enveloped XAdES xml signatures using pkcs11

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.