Cryptware

 

QDigitSign is a class library that implements the Digital Signature primitives as defined in the EU and international regulations for Qualified Digital Signature. QDigitSign supports PKCS#7, CAdES, PAdES and XAdES formats, Timestamp protocol, CRL and OCSP verifications and any PKCS#11 token/HSM. It is available for C/C++, .NET Framework, Java, iOS, Android, Delphi, VB6 etc.

Download Trial Buy

Features

QDigitSign is compliant with any PKCS#11 smart card / token / HSM

It supports the following formats:

  • PKCS#7
  • CAdES
  • PAdES (PDF Signature)
  • XAdES
  • DER, B64 and PEM

It implements the following protocols:

  • Timestamp
  • OCSP verification
  • CRL Download and verification

It is available in the following languages:

  • C#
  • VB.NET
  • C/C++
  • Java
  • Delphi
  • VB 6

Supported Platforms:

  • Windows
  • Linux
  • Unix
  • HP-UX
  • iOS
  • Android
  • Windows Phone

Sample Code (C#)

// By the ATR try to find the matching PKCS#11 Module
string cryptokiPath = DigitalSigner.GetMathingCryptokiPath();

DigitalSigner dsign = new DigitalSigner(cryptokiPath);

// Open a session with the first available token 
dsign.OpenSession(0);
            
// login
dsign.Login("12345678");
            
// Signer Certificate selection

// SimpleCertificateSelector allow to select the signer certificate in the token
// QualifiedCertificateSelector select automatically the qualified certificate

CertificateSelector certSelector = 
    new SimpleCertificateSelector();

string text = "text to sign";
byte[] bufferToSign = Encoding.Default.GetBytes(text);
​ 
// Applies CADES signature
SignedDocument signedDocument = 
    dsign.Sign(bufferToSign, certSelector, true, false);

// verifica la firma
bool b = signedDocument.Verify();

​
...

Sample Code (C)


QDIGITSIGN_CTX ctx;
int ret;

// set optional config file if any
ret = qdigitsign_set(QDIGITSIGN_OPT_CONFIG_FILE, "config.conf");

// set log file
ret = qdigitsign_set(QDIGITSIGN_OPT_LOG_FILE, "log.log");

// set log level
ret = qdigitsign_set(QDIGITSIGN_OPT_LOG_LEVEL, LOG_TYPE_DEBUG);

// set the license if any
ret = qdigitsign_set(QDIGITSIGN_OPT_LICENSEE, "<licensee>");
ret = qdigitsign_set(QDIGITSIGN_OPT_PRODUCTKEY, "<productkey");

// initialize the signature engine
ctx = qdigitsign_sign_init();

// set PKCS#11 module
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_PKCS11, "smaoscki");

// set CAdES option   
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_CADES, 1);

// set the smart card PIN
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_PIN, "1234");

// set the certificate alias (i.e. the Label in PKCS#11 speaking)
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_ALIAS, "signature");

// set the file to sign
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_INPUTFILE, "test.docx");

// set the optional TSA information
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_TSA_URL, "<tsaurl>");
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_TSA_USERNAME, "<username>");
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_TSA_PASSWORD, "<password>");

// set optional output file
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_OUTPUTFILE, "test.txt.p7m");

// set the filetype
ret = qdigitsign_sign_set(ctx, QDIGITSIGN_OPT_INPUTFILE_TYPE, QDIGITSIGN_FILETYPE_PLAINTEXT);

// Sign
ret = qdigitsign_sign_sign(ctx);

// cleanup after signing
qdigitsign_sign_cleanup(ctx);..
http://www.cryptware.com/Default.aspx?pageid=14