EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to use UnformatAttributeValue

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#25113
Posted: 05/30/2013 06:47:44
by Adrián Sabido Racineux (Standard support level)
Joined: 03/15/2013
Posts: 3

Hello.

We want to use this function to know the value of these parameters :

TElCMSSignature.CustomSignedAttributes.Values

Any examples?

thanks.
#25114
Posted: 05/30/2013 07:00:21
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Here is the sample:

Code
var
  Sig : TElCMSSignature;
  TagID : integer;
  Val : BufferType;
begin
  ...
  Val := UnformatAttributeValue(Sig.CustomSignedAttributes.Values[0], TagID);
  ...
end;


After the call to UnformatAttributeValue TagID contains value ID and Val contains actual data. Possible values for TagID can be found in SBASN1Tree unit (SB_ASN1_BOOLEAN, SB_ASN1_INTEGER etc.).
#25115
Posted: 05/30/2013 07:18:28
by Adrián Sabido Racineux (Standard support level)
Joined: 03/15/2013
Posts: 3

Thanks.

After the call to UnformatAttributeValue TagID contains value : SB_ASN1_SEQUENCE

Code
Val := UnformatAttributeValue(Sig.CustomSignedAttributes.Values[0], TagID);


How could I transform data (Val) to a text string?

Thanks.
#25116
Posted: 05/30/2013 07:23:44
by Vsevolod Ievgiienko (EldoS Corp.)

In case when TagID is SB_ASN1_PRINTABLESTRING you can simply type-cast Val to AnsiString type. In case of SB_ASN1_UTF8STRING you can get a string using SBStrUtils.UTF8ToStr(Val) function.

In case of SB_ASN1_SEQUENCE most likely its not a string value.
#25117
Posted: 05/30/2013 07:26:53
by Vsevolod Ievgiienko (EldoS Corp.)

UPD: Sequences usually contain a number of other values. So you should know this attribute ASN.1 structure to understand how to parse it and extract needed data.
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

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