RE: Problem verifying a signed message

"Pawling, John" <[email protected]> Mon, 18 Mar 2002 11:15:36 -0500
Newsgroups gmane.ietf.sfl
Message-ID <[email protected]>
Manfred,

Bob meant to say that the "encoding difference is due to the ASN.1 DER
encoding rule that states that the SET OF must be numerically ordered."

===========================================
John Pawling, [email protected]
Getronics Government Solutions, LLC
===========================================



-----Original Message-----
From: Colestock, Robert 
Sent: Monday, March 18, 2002 9:31 AM
To: '[email protected]'; [email protected]
Cc: Pawling, John
Subject: RE: Problem verifying a signed message


Manfred:

Thank you for your detailed analysis, I was able to diagnose the encoding
more quickly.

After investigating our ASN.1 encoding of the signed attributes of this
message, I believe the SFL encoding is correct.  The encoding difference is
due to the ASN.1 DER encoding rule that states that the SEQUENCE OF must be
numerically ordered.  The SFL ordering is correct, but in this case it may
not be obvious why.  The DER rules indicate the the ordering must be made on
the data, not the outer tag and length.  Ignoring the tag and length, the
2nd and 3rd SEQUENCE items of the SignedAttrs are as follows (from original
message not re-encoded results):

...
30 18 06 09 2A 86 48 86 F7 OD 01 09 03 31 0B 06 ...
30 1C 06 09 2A 86 48 86 F7 OD 01 09 05 31 0F 17 ...
30 23 06 09 2A 86 48 86 F7 OD 01 09 04 31 16 04 ...
...

Our DER re-encoded results:
...
30 18 06 09 2A 86 48 86 F7 OD 01 09 03 31 0B 06 ...
30 23 06 09 2A 86 48 86 F7 OD 01 09 04 31 16 04 ...
30 1C 06 09 2A 86 48 86 F7 OD 01 09 05 31 0F 17 ...
                                    ** <<< ORDERED VALUE >>>
...

IGNORING the 23 AND 1C lengths, the ordering occurs on the "**" flagged
values (04 AND 05).

I hope this helps.  I personally wrote this particular DER encoding
modification in the SNACC compiler (it was originally a BER encoding
compiler).  You may already be aware of this, but if you attempt to write
the logic that sorts the SEQUENCE OF elements, be careful of the byte count
of the lengths (82 01 01 for example indicates 2 bytes, 257 value).

Bob Colestock
VDA.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, March 18, 2002 8:40 AM
To: [email protected]
Subject: Problem verifying a signed message


I have a problem during signature verification of the attached message.

In the function "CSM_MsgSignerInfo::Verify", the authenticatedAttributes are
encoded via snacc and then
SMTI_Verify is called for signatur verification.

The problem is that snacc produces an different order for the attributes
than the original signer of
the message, so the verification fails.

The question now is, which encoding is correct?

I have observed the same problem with messages signed by Mozilla 0.9.8.

Any help would be greatly appreciated.

Thanks,

Manfred Klug


________________________________________________________________
Keine verlorenen Lotto-Quittungen, keine vergessenen Gewinne mehr! 
Beim WEB.DE Lottoservice: http://tippen2.web.de/?x=13