EldoS | Feel safer!

Software components for data protection, secure storage and transfer

how to bundle/unbundle (attach/detach) signature

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#12195
Posted: 01/26/2010 16:33:05
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

Hello Innokentiy,
sorry for the many questions, but I believe the documentation is quite unclear to one point.
If I use the TElSignedCMSMessage, I do not really see the difference between the methods CreateNew() and Content->Init(). Do I need to call both of them?

Currently I am doing as follows:
1) if i want to open an existing message with detached document/signature:
aMessage = new TElSignedCMSMessage(0);
aMessage->Detached = true;
aMessage->Open(aInSignatureStream, aInDocumentStream);

2) if i want to create a new message i use:
aMessage = new TElSignedCMSMessage(0);
aMessage->Detached = true;
aMessage->CreateNew(aInDocumentStream, 0, aInDocumentStream->Size);

--
That's it. I can work with both variants. I don't need a createnew() in the first variant, and don't need a content->init in both variants.
Is that correct to you? Thanks for your reply, and please also give me a last confirmation about the "configure signature" part in my previous post!

Thanks,
regards
christoph
#12200
Posted: 01/27/2010 01:21:54
by Ken Ivanov (EldoS Corp.)

In general, all the code is correct, but I have two notes:
1) Not sure about the below construction. Does C++ builder use such notation for choosing set elements (I am not an expert in it)?
aSignature->SigningOptions << csoInsertMessageDigests << csoInsertSigningTime << csoIncludeCertToMessage;

2) Assign the hash algorithm value to the DigestAlgorithm property instead of the FingerprintAlgorithm one:
aSignature->FingerprintAlgorithm = mSignatureHashMethod; // Use DigestAlgorithm property instead

Quote
If I use the TElSignedCMSMessage, I do not really see the difference between the methods CreateNew() and Content->Init(). Do I need to call both of them?

CreateNew() calls Content->Init() internally. You can also call Content->Init() later if you need to change the data to be signed.

Your code that opens and creates the message is correct too. You even do not have to set the Detached property prior to creating or loading the message (just before saving it).
#12203
Posted: 01/27/2010 01:48:18
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

Hi Innokentiy,
thanks for your reply.

As to 1), yes, that's correct syntax. I admit it's quite a strange operator overloading - i also was quite puzzled to see the Borland choose that strange operator for assigning a option set ;)

As to 2) thanks for the hint. Wouldn't have known that.

Thanks for confirmation to CreateNew() and Content->Init().

I'm all set for now.
Regards,

christoph

Reply

Statistics

Topic viewed 5758 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!