Archived Forum Post

Index of archived forum posts

Question:

Crypt - problem with SignStringENC

Feb 19 '13 at 08:34

I want to sign some text, but I'm getting different output from my code (using Visual Foxpro and Chilkat) and from OpenSSL. My code (Chilkat) returns about 3 times more output text then OpenSSL.

I don't know why a I don't know if it could be OK or not. Anyone to help me please?

(I used another variations of code too, signing files, etc. - still the same problem).

I have suspicion, that Chilkat returns signed data AND signature (see "AddingFinalCertWithSerialNumber" and "addingCert" in LastErrorText) - is it possible (see original doc)?

SignStringENC - original documentation: Digitally signs a string and returns the PKCS7 detached digital signature as an encoded string.

Simple Code FoxPro:

SetSigningCert(xxx)
EncodingMode = "Base64"
IncludeCertChain = 0
SignStringENC(Text_to_sign)

LastErrorText:

ChilkatLog:
  SignStringENC:
    DllDate: Aug  5 2012
    UnlockPrefix: TOMASKCrypt
    Username: ...
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SigningCert:
      SubjectDN: C=CZ, L=..., OU=..., CN=..., SN=...
      SerialNumber: ...
    --SigningCert
    hashAlgorithm: sha1
    createPkcs7Signature:
      detachedSignature: 1
      numSigningCerts: 1
      issuerSerialNum: ...
      numAsnBytesToSign: 35
      rsaSigLen: 256
      AddingCertsToASN:
        Not embedding certificate chain..
        AddingFinalCertWithSerialNumber: ...
        addingCert: C=CZ, L=..., OU=..., CN=..., SN=...
        numCertsAdded: 1
      --AddingCertsToASN
    --createPkcs7Signature
    Success.
  --SignStringENC
--ChilkatLog

OpenSSL:

openssl smime -sign -outform pem -signer c:xxx.pem -in data_in.txt -out data_out.txt -nocerts