[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Losing header bytes



The following is just an FYI.  It’s been a while since I’ve looked at this code, but the following info may be useful to you.

 

 

If I had to guess I would say that you are decoding syntax like:

                                                                           

someSeq ::= SET/SEQ {

 

someAny [0] ANY

}

 

This is sounds like an old problem; which was resolved by adding AsnBuf::ResetMode() calls to AsnAny::BEnc()   The old symptom was:

 

When you decode using someSeq.BDec the resultant someSeq.someAny it will not contain the outer 0XA0 0x82 0x0F 0XCE.  The code for that lives in the someSeq BEncContent and someSeq.BDecContent.  This is normal and correct.  If you expect to see the outer context specific tag & length you need to use someSeq.BEnc().

 

eSNACC requires that ANYs are valid encodings.  So when decoding the ANY it reads the outer tag and length of the ANY (0x31 0x82 0x01 0x77).  The remaining is considered to be the content of the ANY.  Each AsnyAny has an AsnBuf or AsnType (via DEFINED BY).  In this case I’m guessing it’s, as the syntax above suggests, is a plain ole ANY.  If you just turned around an encoded the ANY in this state it will encode from where it left off.  In other words you couldn’t just do:

 

someSeq.someAny.BEnc() and expect to see the full ANY.  You need to reset the buffer associated with the ANY.

 

someSeq.someAny.anyBuf->ResetMode()

 

However, I know we added code to AsnBuf.BEnc() to reset the buffer.  So that should be working unless there is a bug in AsnBuf.

 

 

-Pierce

 

 


From: owner-imc-snacc@xxxxxxxxxxxx [mailto:owner-imc-snacc@xxxxxxxxxxxx] On Behalf Of Horvath, Tom (US SSA)
Sent: Friday, February 03, 2006 10:50 AM
To: John Hodgkinson; imc-snacc@xxxxxxx
Subject: RE: Losing header bytes

 

John,

 

Would it be possible for you to send us the test driver that you are using or to isolate the code you are having problems with and put that in a test driver which repeats the problem and then send that to us?

 

Thanks,

Tom

 


From: owner-imc-snacc@xxxxxxxxxxxx [mailto:owner-imc-snacc@xxxxxxxxxxxx] On Behalf Of John Hodgkinson
Sent: Friday, February 03, 2006 6:47 AM
To: imc-snacc@xxxxxxx
Subject: Losing header bytes

 

Hello,

 

I have taken a blob of ASN1 and decoded it using the BDec method of the eSNACC generated code and then used the BEnc to re-encode it and this has lost the initial header information from the original blob.

 

Thus  0xA0, 0x82, 0x0F, 0xCE, 0x31, 0x82, 0x01, 0x77 is missing from the start

 

Where 0FCE is the length of the encoded data (AsnBuf.length minus the 4 byte message header length (0x31 0x82 0x01 0x77))

The length of the header can be obtained by encoding the message header separately.

Is it possible to obtain the original header information from the decoded data?

 

Thanks

John