login about faq


i'm tryimg to test one of your functions (Digital Sigantures), which is: "PKCS7 SignedData Detached Signature" as follow:

void ChilkatSample(void) { CkCrypt2 crypt;

//  Any string argument automatically begins the 30-day trial.
bool success;
success = crypt.UnlockComponent("30-day trial");
if (success != true) {
    printf("Crypt component unlock failed\n");

CkCert cert;
success = cert.LoadByCommonName("Merchant");
if (success != true) {

//  Make sure this certificate has a private key available:
bool bHasPrivateKey;
bHasPrivateKey = cert.HasPrivateKey();
if (bHasPrivateKey != true) {
    printf("No private key available for signing.\n");

//  Tell the encryption component to use this cert.

const char * strData;
strData = "This is the data to be signed.";

//  Indicate that the PKCS7 signature should be returned
//  as a base64 encoded string:

//  The EncodingMode may be set to other values such as
//  "hex", "url", "quoted-printable", etc.

const char * strSignature;
strSignature = crypt.SignStringENC(strData);

printf("%s\n",(const char *)strSignature);

//  Now verify the signature against the original data.

//  Tell the component what certificate to use for verification.

success = crypt.VerifyStringENC(strData,strSignature);
if (success == true) {
    printf("digital signature verified\n");
else {
    printf("digital signature invalid\n");

//  Try it with incorrect data:
success = crypt.VerifyStringENC("This is not the signed data",strSignature);
if (success == true) {
    printf("digital signature verified\n");
else {
    printf("digital signature invalid\n");


Evebthough i did not change anything in the code (Ecxept for adding the digital certificate), i keep getting the following 2 errors:

[bcc32 Error] digital signature PKCS7.cpp(61): E2193 Too few parameters in call to 'CkCrypt2::SignStringENC(const char ,CkString &)' [bcc32 Error] digital signature PKCS7.cpp(61): E2034 Cannot convert 'bool' to 'const char '

So, can you please tell me what is the problem!! Regards, rania

asked Mar 13 '13 at 08:31

rania's gravatar image


Each Chilkat C++ method that returns a string has two versions — an upper-case version that returns the string in a CkString (always the last argument), and a lower-case version that returns a "const char *".

For example, in the CkCrypt2 class:

bool CkCrypt2::SignStringENC(const char str, CkString &outStr);
const char CkCrypt2::signStringENC(const char str);
The lower-case method returning a "const char " returns a pointer to memory that may be overwritten in subsequent calls. Therefore, make sure to copy the string to a safe place immediately before making additional calls on the same Chilkat object instance. (Only methods that also return "const char *" would overwrite the memory from a previous call.)

The upper-case version of the method returns the string in a CkString object. It is an output-only argument, meaning that the CkString contents are replaced, not appended.


answered Mar 13 '13 at 10:23

chilkat's gravatar image

chilkat ♦♦

edited Mar 13 '13 at 10:23

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Mar 13 '13 at 08:31

Seen: 1,536 times

Last updated: Mar 13 '13 at 10:23

powered by OSQA