EldoS | Feel safer!

Software components for data protection, secure storage and transfer

MessageSigner

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#28199
Posted: 01/30/2014 09:54:59
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

Hi, I'm currently trying to PKCS#7 sign data with Aladdin tokens, accessing the tokens and signing is working fine however I got two questions:

1. Somehow I don't seem to be able to add ContentType to the output CMS, can you please look at the code below and tell me what's wrong?

2. I need to add two signatures on one file, is that possible with MessageSigner and if so can you give me some examples? (Found it: just add multiple certificates)

Code
Dim signer As New TElMessageSigner
        
Dim MemoryCertStorage As TElMemoryCertStorage = New TElMemoryCertStorage
MemoryCertStorage.Add(cert, True)

signer.CertStorage = MemoryCertStorage
signer.RecipientCerts = MemoryCertStorage

signer.SigningOptions = SBMessages.Unit.soInsertSigningTime
signer.HashAlgorithm = SBConstants.Unit.SB_ALGORITHM_DGST_SHA256
signer.ContentType = SBStrUtils.Unit.StrToOID("1.2.616.1.101.4.1.1")
signer.AuthenticatedAttributes.Count = 1
signer.AuthenticatedAttributes.Attributes(0) = SBStrUtils.Unit.StrToOID("1.2.840.113549.1.9.4")



Many thanks,
Marco
#28203
Posted: 01/31/2014 02:18:00
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

Hi,

Anything on number 1?

1. Somehow I don't seem to be able to add ContentType to the output CMS, can you please look at the code below and tell me what's wrong?

Thanks,
Marco
#28204
Posted: 01/31/2014 02:23:50
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Quote
1. Somehow I don't seem to be able to add ContentType to the output CMS

The code is correct. Could you clarify how do you check if its added or not?
#28205
Posted: 01/31/2014 02:56:28
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

Thanks for the reply,

I'm checking the output with sample project ELDOS CMS Manager.

In attached screenshot the top one is from an example singed file, the bottom one is from the code above.

Marco


#28208
Posted: 01/31/2014 03:06:31
by Vsevolod Ievgiienko (EldoS Corp.)

Please click on CMS item from the tree. You'll see ContentType.
#28211
Posted: 01/31/2014 05:06:24
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

You are right, it does show there.

Any particular reason it does not show at signature level like with the other file?

Thanks,
Marco
#28212
Posted: 01/31/2014 05:17:01
by Vsevolod Ievgiienko (EldoS Corp.)

ContentType may be duplicated on both document and signature levels. If its displayed on document level then it was not duplicated to signature level.
If you need such duplication you can use our TElSignedCMSMessage class and set TElCMSSignature.ContentType property for each added signature.
#28227
Posted: 01/31/2014 11:10:26
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

Thank you, that explains...

My messages are rejected by the server so I think I should add ContentType to signature level too.

Are there any examples available on how to go from TELMessageSigner to TELSignedCMSMessage? I wonder if this value be changed after signature creation?

Thanks,
Marco
#28228
Posted: 01/31/2014 11:15:34
by Vsevolod Ievgiienko (EldoS Corp.)

Quote
Are there any examples available on how to go from TELMessageSigner to TELSignedCMSMessage?

The sample you've used to view CMS is a good start point.

Quote
I wonder if this value be changed after signature creation?

Do you mean that you want to change ContentType of existing signature?
#28236
Posted: 02/01/2014 05:13:33
by marco hagen (Standard support level)
Joined: 11/09/2013
Posts: 33

Yes thanks, CMS sample has plenty of info.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 2387 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!