directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: ava.io.EOFException: ERR_00021 EOF encountered in middle of object; org.apache.directory.shared.asn1.der.ASN1InputStream.readFully
Date Wed, 29 Feb 2012 17:58:53 GMT
FYI, the decoded AS-REP message and KRB-ERROR messages, once decoded, are  :

AS-REP
pvno : 5
msg-type : padata : PreAuthenticationData : {
     padata-type: null(0)
     padata-value:0x30 0x22 0x30 0x20 0xA0 0x03 0x02 0x01 0x11 0xA1 0x19 
0x1B 0x17 0x43 0x52 0x59 0x50 0x54 0x4F 0x2E 0x43 0x53 0x2E 0x4A 0x4D 
0x55 0x2E 0x45 0x44 0x55 0x77 0x61 0x6E 0x67 0x78 0x78
}

crealm : CRYPTO.CS.JMU.EDU
cname : PrincipalName : {
     name-type: KRB_NT_PRINCIPAL
     name-string : <'wangxx'>
}
ticket : Ticket :
   tkt-vno : 5
   realm : CRYPTO.CS.JMU.EDU
   sname : PrincipalName : {
     name-type: KRB_NT_SRV_INST
     name-string : <'krbtgt', 'CRYPTO.CS.JMU.EDU'>
}
   enc-part : EncryptedData : {
     etype: rc4-hmac (23)
     kvno: 2
     cipher: 0x64 0x4C 0x42 0x02 0x42 0x0D 0xC2 0xF8 0x77 0x71 0x01 0xF9 
0x29 0xA1 0xBB 0xE5 0x88 0x2D 0x1B 0x53 0x51 0x46 0x12 0xB9 0x56 0x27 
0x22 0xCA 0xF3 0xBB 0xDE 0x64 0xA3 0xD9 0x2A 0x9B 0x46 0x20 0x4D 0xFC 
0x45 0x3E 0x03 0xEE 0xD6 0xA2 0x95 0x09 0x55 0xC4 0x0A 0x7C 0xE0 0x4B 
0x1B 0xC0 0xB7 0x25 0x61 0x4E 0xA7 0xA3 0x48 0x85 0x90 0x3D 0x54 0x4D 
0xE4 0x33 0x9E 0x12 0x18 0xE3 0xAF 0xC0 0x43 0x85 0x98 0xEA 0xB5 0x9D 
0x2F 0xBB 0x59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0xA2 0xC2 0x1D 0x32 0xC2 0xE2 0x84 0x06 0xDD 0x64 0xA7 0x52 
0x1D 0x80 0x9D 0xB1 0x54 0xB6 0xF3 0x6A 0x68 0x39 0x9B 0xED 0xCB 0x3A 
0xC9 0x09 0x06 0xF3 0x16 0xB8 0xB6 0x7E 0xBB 0xC3 0xCD 0x3B 0x5B 0x5E 
0x99 0x1A 0x25 0x13 0x9E 0xE8 0xBF 0xF9 0x49 0x35 0x34 0x0C 0x7D 0xDB 
0x2D 0x33 0x78 0x3B 0xFD 0xB9 0xB7 0x9D 0xC1 0x3B 0x62 0xE6 0x00 0xC8 
0x01 0xB0 0xF9 0x90 0x83 0x03 0x91 0xB7 0x52 0x63 0x52 0xBF 0x4C 0x79 
0x9E 0x30 0x93 0x71 0xDC 0x10 0x90 0x76 0x56 0x49 0xD2 0xA9 0x34 0xF0 
0xCA 0x9E 0x07 0xA7 0x8F 0x8C 0xD5 0x9E 0x42 0xF9 0xC8 0x02 0x46 0xC2 
0x9F 0xE1 0x7D 0x33 0xB9 0x6B 0x2B 0x7D 0x36 0x4B 0x29 0x1E 0x86 0x45 
0xF0 0xAA 0x6E 0x72 0x63 0xC1 0xEA 0xB1 0xE7 0xA3 0x23 0x1F 0x55 0x62 
0xFA 0x9B 0x77 0x63 0x2C 0x2C 0x48 0x96 0x09 0xBE 0xE1 0x58 0xC1
}


enc-part : EncryptedData : {
     etype: aes128-cts-hmac-sha1-96 (17)
     kvno: 2
     cipher: 0x38 0xBF 0xBD 0xEF 0x76 0x13 0xDE 0xDE 0x4F 0x09 0x66 0x24 
0x60 0xDB 0x2E 0xBC 0xAD 0x50 0xFA 0x61 0xF8 0xCB 0xA9 0xCC 0xBD 0xC1 
0x5A 0x50 0x48 0xF2 0xDE 0x99 0xF6 0xC9 0xEC 0x4A 0x68 0xDF 0xF5 0x95 
0xED 0x92 0x8B 0x93 0x28 0xD1 0x04 0xBC 0xA8 0x68 0x23 0xF8 0x59 0x59 
0xD8 0x21 0xC6 0x2F 0x48 0x8A 0xCF 0x50 0x43 0x18 0x40 0x89 0x0D 0x52 
0x1B 0xE2 0xD8 0x33 0x25 0x71 0xA4 0x3E 0x0D 0x23 0x87 0x35 0xA8 0xD1 
0x88 0xA2 0x3B 0x5E 0x81 0x77 0x6B 0x15 0x17 0x70 0xB5 0x16 0xC0 0xE3 
0x47 0x8D 0xAA 0xBD 0x75 0x33 0xB8 0xD9 0x1F 0x80 0x74 0x46 0x35 0xB3 
0x1E 0x6E 0x85 0xDF 0xE0 0x12 0x00 0xC7 0x16 0x50 0x39 0x83 0xE5 0x76 
0x72 0xE4 0x96 0x24 0x4A 0x9E 0x15 0x6E 0x6A 0xDC 0xBD 0x1B 0xBA 0x35 
0x99 0x7E 0x8D 0xF9 0x3A 0xBD 0x1E 0x6A 0x5F 0xF9 0x79 0x74 0x4D 0xB9 
0x8E 0x18 0x0C 0xC5 0x65 0x3A 0x59 0x81 0xA3 0x82 0x85 0xFC 0xF1 0x32 
0x3A 0x24 0x78 0x87 0xFC 0xF1 0xDF 0x76 0x0D 0x15 0xA4 0xBF 0x2F 0x2C 
0x5F 0x1C 0xC8 0x8C 0x8D 0x3E 0xAD 0x1F 0x1B 0xD8 0xFA 0x96 0x41 0xF3 
0x21 0x2C 0x13 0x92 0x4D 0x98 0x74 0x75 0x6C 0x82 0x2C 0x0B 0xEB 0xE4 
0xD4 0x5B 0xC2 0xA4 0x7A 0xE4 0x1D 0x31 0x9A 0x26 0x7E 0xD2 0x6A 0xD9 
0xD7 0xF9 0x67 0x1C 0x38 0xA2 0x81 0x05 0xE1 0x8B 0xBE 0x5C 0x7D 0xD2 
0xA0 0x0C 0x0A 0xF0 0x8A 0x48 0x13 0x35 0xDB 0x9D 0xA3
}


KRB-ERROR : {
     pvno: 5
     msgType: KRB_ERROR
     sTime: null
     susec: 0
     errorCode: null
     realm: null
     sName: null
}


Here is the modified code I used :

package org.apache.directory;

import static org.junit.Assert.fail;

import java.nio.ByteBuffer;

import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.ber.Asn1Decoder;
import org.apache.directory.shared.kerberos.codec.asRep.AsRepContainer;
import 
org.apache.directory.shared.kerberos.codec.krbError.KrbErrorContainer;
import org.apache.directory.shared.kerberos.messages.AsRep;
import org.apache.directory.shared.kerberos.messages.KrbError;
import org.apache.directory.shared.util.Strings;

public class SimpleDecoder {
     private String asErrorStr = 
"7e82010e3082010aa003020105a10302011ea411180f32303132303231373033333933355aa505020303b5daa603020119a9131b1143525950544f2e43532e4a4d552e454455aa263024a003020102a11d301b1b066b72627467741b1143525950544f2e43532e4a4d552e454455ac81a104819e30819b3078a103020113a271046f306d3020a003020111a1191b1743525950544f2e43532e4a4d552e45445577616e6778783005a0030201173020a003020103a1191b1743525950544f2e43532e4a4d552e45445577616e6778783020a003020101a1191b1743525950544f2e43532e4a4d552e45445577616e6778783009a103020102a20204003009a103020110a20204003009a10302010fa2020400";

     private String asRepStr = 
"6b82055f3082055ba003020105a10302010ba231302f302da103020113a226042430223020a003020111a1191b1743525950544f2e43532e4a4d552e45445577616e677878a3131b1143525950544f2e43532e4a4d552e454455a4133011a003020101a10a30081b0677616e677878a58203e1618203dd308203d9a003020105a1131b1143525950544f2e43532e4a4d552e454455a2263024a003020102a11d301b1b066b72627467741b1143525950544f2e43532e4a4d552e454455a38203933082038fa003020117a103020102a28203810482037d644c4202420dc2f8777101f929a1bbe5882d1b53514612b9562722caf3bbde64a3d92a9b46204dfc453e03eed6a2950955c40a7ce04b1bc0b725614ea7a34885903d544de4339e1218e3afc0438598eab59d2fbb59bdec951df6055ecc449dfc041534d125a71851fb9de91eec35af9d8c588a32929e1ea31fdd8d40987af5cdaa70f6ad06cac744cf7989be7c668a4d0af97cf3865e5070c6ff44d3f1abf3fbae432e3336d8b4d06daa0181c98485f4d331d29fafd01a0625673ba3dd9fe65f4317f3c4fa3c45a26ccc3caa6515b585a2bb3c3fa781046274e33bc94518cc2fd27fb60ecbe2479f330b3530a011865ff0a15282d27e5b3f1e2e34131efe28ed819b1c73ce27dfb1c5e5419aa68fcc3c3994bdc37c53e1ac03f645fb00bc24ff3506a9d11c7e63dddde938ac88947f810217be6f5bb1c3d691a07374e4580a34c56b04f0823e6569f0a8c51b3c8c8a0fbb9663859e0ec210e61e22860ae4c56611b2bfe375438838cd11c593d0e2cf6208f3d0f2166d23f6350253bc0171a72dcda3d31d33d64607537dbb19c76b8f684d3c619eba19ed8be70b6510a9a578832568bf844f1ea911896af6055eb3a6bfb126c7aa9f951475f336c7d6fa7ef48cd39e8d9946641291ec6799c304d095875c560056c6c482194d0d095859ae46297b9d757a6120482a2ba7c073cc842cb6a0f39294bd7acc7f19e4e12702278624c0d3000580466be313a59d1f4b47f2a699f6da2213997a42483b18f717eff959b330d73c61bf60b3d6b350528b464302b70207c9cabe51ae10898a36c4e939cf412b6f99a09ca86aac8c0043c117a6c4e5f8b606fcab0caeaefae70f359338e58ad16eb5cd3d20c4f758f852c18eec1302cebb63c0c8f448bccb36c2a62e2be3534aba816b7e26672e76e35af3790f84cb57eaaa05bfb49949f8c7bccbb6d228ec49e19dac51cb67ee8908f5772973e5ab000f0ca600bc87f631d21534f69aca1bd656efbf4f26c659b23435c1357091a5ea4166d21ee3f077b889281b9c996678d257e2849aa2c21d32c2e28406dd64a7521d809db154b6f36a68399bedcb3ac90906f316b8b67ebbc3cd3b5b5e991a25139ee8bff94935340c7ddb2d33783bfdb9b79dc13b62e600c801b0f990830391b7526352bf4c799e309371dc1090765649d2a934f0ca9e07a78f8cd59e42f9c80246c29fe17d33b96b2b7d364b291e8645f0aa6e7263c1eab1e7a3231f5562fa9b77632c2c489609bee158c1a682010b30820107a003020111a103020102a281fa0481f738bfbdef7613dede4f09662460db2ebcad50fa61f8cba9ccbdc15a5048f2de99f6c9ec4a68dff595ed928b9328d104bca86823f85959d821c62f488acf50431840890d521be2d8332571a43e0d238735a8d188a23b5e81776b151770b516c0e3478daabd7533b8d91f80744635b31e6e85dfe01200c716503983e57672e496244a9e156e6adcbd1bba35997e8df93abd1e6a5ff979744db98e180cc5653a5981a38285fcf1323a247887fcf1df760d15a4bf2f2c5f1cc88c8d3ead1f1bd8fa9641f3212c13924d9874756c822c0bebe4d45bc2a47ae41d319a267ed26ad9d7f9671c38a28105e18bbe5c7dd2a00c0af08a481335db9da3";

     private byte asRepBytes[] = null;
     private byte asErrBytes[] = null;

     public void init () {
         asRepBytes = Strings.toByteArray( asRepStr );
         asErrBytes = Strings.toByteArray(asErrorStr );
     }

     public void parseMessages () {
         try {
             Asn1Decoder kerberosDecoder = new Asn1Decoder();

             System.out.println ("# of bytes = " + asRepBytes.length);
             ByteBuffer buf = ByteBuffer.wrap (asRepBytes);
             AsRepContainer asRepContainer = new AsRepContainer( buf );
             asRepContainer.setAsRep( new AsRep() );

             // Decode the KdcRep PDU
             try
             {
                 kerberosDecoder.decode( buf, asRepContainer );
             }
             catch ( DecoderException de )
             {
                 fail( de.getMessage() );
             }

             AsRep asRep = asRepContainer.getAsRep();

             System.out.println( asRep );

             System.out.println( 
"---------------------------------------------------------" );
             ByteBuffer buf2 = ByteBuffer.wrap (asErrBytes);
             KrbErrorContainer krbErrorContainer = new 
KrbErrorContainer( buf2 );
             krbErrorContainer.setKrbError( new KrbError() );

             try
             {
                 kerberosDecoder.decode( buf2, asRepContainer );
             }
             catch ( DecoderException de )
             {
                 fail( de.getMessage() );
             }

             KrbError krbError = krbErrorContainer.getKrbError();

             System.out.println( krbError );

         } catch (Exception ex) {
             ex.printStackTrace ();
         }
     }

     public static void main (String[] args) {
         SimpleDecoder sd = new SimpleDecoder ();
         sd.init ();
         sd.parseMessages ();
     }
}



Le 2/29/12 6:16 PM, Wang, Xunhua - wangxx a écrit :
> Hi,
>
> Hope I am posting to the right list. If not, please let me know.
>
> I am trying to use the org.apache.directory.server.kerberos.shared.io.decoder.KdcReplyDecoder
and the ErrorMessageDecoder classes to parse an AS_REP message and an error message (In response
to an AS_REQ request).
>
> However, in both cases, I got the following error:
> +++++ ERROR BEGINS +++++
> java.io.EOFException: ERR_00021 EOF encountered in middle of object.
>          at org.apache.directory.shared.asn1.der.ASN1InputStream.readFully(ASN1InputStream.java:176)
>          at org.apache.directory.shared.asn1.der.ASN1InputStream.readObject(ASN1InputStream.java:523)
>          at org.apache.directory.server.kerberos.shared.io.decoder.KdcReplyDecoder.decode(KdcReplyDecoder.java:64)
>          at SimpleDecoder.parseMessages(SimpleDecoder.java:25)
>          at SimpleDecoder.main(SimpleDecoder.java:39)
> +++++ ERROR ENDS +++++
>
> In the following code, these messages are copied from real Kerberos traffic and they
can be parsed by Wireshark.
>
> What have I done wrong?
>
> Thank you.
>
> Steve
>
> ++++++++++ CODE BEGINS ++++++++++
> import java.nio.ByteBuffer;
>
> import org.apache.directory.server.kerberos.shared.io.decoder.*;
> import org.apache.directory.server.kerberos.shared.messages.*;
>
> public class SimpleDecoder {
> 	private String asErrorStr = "7e82010e3082010aa003020105a10302011ea411180f32303132303231373033333933355aa505020303b5daa603020119a9131b1143525950544f2e43532e4a4d552e454455aa263024a003020102a11d301b1b066b72627467741b1143525950544f2e43532e4a4d552e454455ac81a104819e30819b3078a103020113a271046f306d3020a003020111a1191b1743525950544f2e43532e4a4d552e45445577616e6778783005a0030201173020a003020103a1191b1743525950544f2e43532e4a4d552e45445577616e6778783020a003020101a1191b1743525950544f2e43532e4a4d552e45445577616e6778783009a103020102a20204003009a103020110a20204003009a10302010fa2020400";
>
> 	private String asRepStr = "6b82055f3082055ba003020105a10302010ba231302f302da103020113a226042430223020a003020111a1191b1743525950544f2e43532e4a4d552e45445577616e677878a3131b1143525950544f2e43532e4a4d552e454455a4133011a003020101a10a30081b0677616e677878a58203e1618203dd308203d9a003020105a1131b1143525950544f2e43532e4a4d552e454455a2263024a003020102a11d301b1b066b72627467741b1143525950544f2e43532e4a4d552e454455a38203933082038fa003020117a103020102a28203810482037d644c4202420dc2f8777101f929a1bbe5882d1b53514612b9562722caf3bbde64a3d92a9b46204dfc453e03eed6a2950955c40a7ce04b1bc0b725614ea7a34885903d544de4339e1218e3afc0438598eab59d2fbb59bdec951df6055ecc449dfc041534d125a71851fb9de91eec35af9d8c588a32929e1ea31fdd8d40987af5cdaa70f6ad06cac744cf7989be7c668a4d0af97cf3865e5070c6ff44d3f1abf3fbae432e3336d8b4d06daa0181c98485f4d331d29fafd01a0625673ba3dd9fe65f4317f3c4fa3c45a26ccc3caa6515b585a2bb3c3fa781046274e33bc94518cc2fd27fb60ecbe2479f330b3530a011865ff0a15282d27e5b3f1e2e34131efe28ed819b1c73ce27dfb1c5e5419aa68fcc3c3994bdc37c53e1ac03f645fb00bc24ff3506a9d11c7e63dddde938ac88947f810217be6f5bb1c3d691a07374e4580a34c56b04f0823e6569f0a8c51b3c8c8a0fbb9663859e0ec210e61e22860ae4c56611b2bfe375438838cd11c593d0e2cf6208f3d0f2166d23f6350253bc0171a72dcda3d31d33d64607537dbb19c76b8f684d3c619eba19ed8be70b6510a9a578832568bf844f1ea911896af6055eb3a6bfb126c7aa9f951475f336c7d6fa7ef48cd39e8d9946641291ec6799c304d095875c560056c6c482194d0d095859ae46297b9d757a6120482a2ba7c073cc842cb6a0f39294bd7acc7f19e4e12702278624c0d3000580466be313a59d1f4b47f2a699f6da2213997a42483b18f717eff959b330d73c61bf60b3d6b350528b464302b70207c9cabe51ae10898a36c4e939cf412b6f99a09ca86aac8c0043c117a6c4e5f8b606fcab0caeaefae70f359338e58ad16eb5cd3d20c4f758f852c18eec1302cebb63c0c8f448bccb36c2a62e2be3534aba816b7e26672e76e35af3790f84cb57eaaa05bfb49949f8c7bccbb6d228ec49e19dac51cb67ee8908f5772973e5ab000f0ca600bc87f631d21534f69aca1bd656efbf4f26c659b23435c1357091a5ea4166d21ee3f077b889281b9c996678d257e2849aa2c21d32c2e28406dd64a7521d809db154b6f36a68399bedcb3ac90906f316b8b67ebbc3cd3b5b5e991a25139ee8bff94935340c7ddb2d33783bfdb9b79dc13b62e600c801b0f990830391b7526352bf4c799e309371dc1090765649d2a934f0ca9e07a78f8cd59e42f9c80246c29fe17d33b96b2b7d364b291e8645f0aa6e7263c1eab1e7a3231f5562fa9b77632c2c489609bee158c1a682010b30820107a003020111a103020102a281fa0481f738bfbdef7613dede4f09662460db2ebcad50fa61f8cba9ccbdc15a5048f2de99f6c9ec4a68dff595ed928b9328d104bca86823f85959d821c62f488acf50431840890d521be2d8332571a43e0d238735a8d188a23b5e81776b151770b516c0e3478daabd7533b8d91f80744635b31e6e85dfe01200c716503983e57672e496244a9e156e6adcbd1bba35997e8df93abd1e6a5ff979744db98e180cc5653a5981a38285fcf1323a247887fcf1df760d15a4bf2f2c5f1cc88c8d3ead1f1bd8fa9641f3212c13924d9874756c822c0bebe4d45bc2a47ae41d319a267ed26ad9d7f9671c38a28105e18bbe5c7dd2a00c0af08a481335db9da3";
>
> 	private byte asRepBytes[] = null;
> 	private byte asErrBytes[] = null;
>
> 	public void init () {
> 		asRepBytes = stringToHex (asRepStr, 0);
> 		asErrBytes = stringToHex (asErrorStr, 0);
> 	}
>
> 	public void parseMessages () {
> 		try {
>
> 			System.out.println ("# of bytes = " + asRepBytes.length);
> 			ByteBuffer buf = ByteBuffer.wrap (asRepBytes);
> 			org.apache.directory.server.kerberos.shared.io.decoder.KdcReplyDecoder kryDecoder
= new
> 				org.apache.directory.server.kerberos.shared.io.decoder.KdcReplyDecoder ();
> 			KdcReply kry = kryDecoder.decode (buf);
>
> 			ErrorMessageDecoder emd = new ErrorMessageDecoder ();
> 			ByteBuffer buf2 = ByteBuffer.wrap (asErrBytes);
> 			ErrorMessage em = emd.decode (buf2);
> 			System.out.println (em.toString ());
> 		} catch (Exception ex) {
> 			ex.printStackTrace ();
> 		}
> 	}
>
> 	public static void main (String[] args) {
> 		SimpleDecoder sd = new SimpleDecoder ();
> 		sd.init ();
> 		sd.parseMessages ();
> 	}
>
> 	public static byte[] stringToHex (String inString, int startPos) {
> 		String strTemplate = "0123456789ABCDEF";
>
>                  int length = inString.length();
>                  int resLen = (length-startPos)/2;
>                  byte[] res = new byte[resLen];
>
> 		// System.out.println ("::stringToHex inString = " + inString);
>
>                  for (int i = 0; i<  resLen; i++) {
>                      char c1 = inString.charAt(2*i + startPos);
> 			int pos1 = strTemplate.indexOf (c1);
>                      char c2 = inString.charAt(2*i+1 + startPos);
> 			int pos2 = strTemplate.indexOf (c2);
>
> 			/// System.out.println ("Integers are (" + pos1 + "," + pos2 + ")");
>
>                      res[i] = (byte )(( pos1<<  4 | pos2)&  0xff);
>                  }
>
>                  return res;
> 	}
> }
> ++++++++++ CODE ENDS ++++++++++


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Mime
View raw message