KDC-REQ ::= SEQUENCE { -- NOTE: first tag is [1], not [0] pvno [1] INTEGER (5) , msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --), padata [3] SEQUENCE OF OPTIONAL -- NOTE: not empty --, req-body [4] }
150151152153154155156157158159160161162163164165
KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" ); String passPhrase = "badpassword"; PaData[] paDatas = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); for ( PaData paData : paDatas ) { message.addPaData( paData ); } handler.messageReceived( session, message ); Object msg = session.getMessage();
197198199200201202203204205206207208209210211212
KerberosTime timeStamp = new KerberosTime( 0 ); String passPhrase = "secret"; PaData[] paDatas = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase, timeStamp ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); for ( PaData paData : paDatas ) { message.addPaData( paData ); } handler.messageReceived( session, message ); Object msg = session.getMessage();
243244245246247248249250251252253254255256257258
KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" ); String passPhrase = "secret"; PaData[] paDatas = getPreAuthPublicKey( clientPrincipal, passPhrase ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); for ( PaData paData : paDatas ) { message.addPaData( paData ); } handler.messageReceived( session, message ); Object msg = session.getMessage();
122123124125126127128129130131132133134135136137
KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" ); String passPhrase = "secret"; PaData[] paDatas = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); for ( PaData paData : paDatas ) { message.addPaData( paData ); } handler.messageReceived( session, message ); Object msg = session.getMessage();
180181182183184185186187188189190191192193194195
EncryptionKey clientKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 ); KerberosTime timeStamp = new KerberosTime(); PaData[] paDatas = getPreAuthEncryptedTimeStamp( clientKey, timeStamp ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); for ( PaData paData : paDatas ) { message.addPaData( paData ); } handler.messageReceived( session, message ); Object msg = session.getMessage();
241242243244245246247248249250251252253254255256
200201202203204205206207208209210211212213214215216217218219220221222223
catch ( DecoderException de ) { fail( de.getMessage() ); } KdcReq kdcReq = kdcReqContainer.getKdcReq(); // Check the encoding int length = kdcReq.computeLength(); // Check the length assertEquals( 0x193, length ); // Check the encoding ByteBuffer encodedPdu = ByteBuffer.allocate( length ); try { encodedPdu = kdcReq.encode( encodedPdu ); // Check the length assertEquals( 0x193, encodedPdu.limit() ); } catch ( EncoderException ee )
292293294295296297298299300301302303304305306307
132133134135136137138139140141142
long now = System.currentTimeMillis(); KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY ); kdcReqBody.setTill( requestedEndTime ); KdcReq message = getKdcRequest( tgt, kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( "session.getMessage() instanceOf", TgsRep.class, msg.getClass() );
185186187188189190191192193194195