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] }
251252253254255256257258259260261
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() );
317318319320321322323324325326327
384385386387388389390391392393394
452453454455456457458459460461462
KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY ); kdcReqBody.setTill( requestedEndTime ); subSessionKey = RandomKeyFactory.getRandomKey( EncryptionType.DES_CBC_MD5 ); KdcReq message = getKdcRequest( tgt, kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( "session.getMessage() instanceOf", TgsRep.class, msg.getClass() );
106107108109110111112113114115116117
kdcReqBody.setEType( config.getEncryptionTypes() ); KerberosTime till = new KerberosTime(); kdcReqBody.setTill( till ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); handler.messageReceived( session, message ); KrbError error = ( KrbError ) session.getMessage();
129130131132133134135136137138139140141
kdcReqBody.setCName( getPrincipalName( "hnelson" ) ); kdcReqBody.setSName( getPrincipalName( "hnelson" ) ); kdcReqBody.setRealm( "EXAMPLE.COM" ); kdcReqBody.setEType( config.getEncryptionTypes() ); KdcReq message = new AsReq(); message.setProtocolVersionNumber( 4 ); message.setKdcReqBody( kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
185186187188189190191192193194195196
kdcReqBody.setCName( getPrincipalName( "baduser" ) ); kdcReqBody.setSName( getPrincipalName( "hnelson" ) ); kdcReqBody.setRealm( "EXAMPLE.COM" ); kdcReqBody.setEType( config.getEncryptionTypes() ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
231232233234235236237238239240241242243244245246
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();
267268269270271272273274275276277278279280281282
297298299300301302303304305306307308
kdcReqBody.setCName( getPrincipalName( "tquist" ) ); kdcReqBody.setSName( getPrincipalName( "hnelson" ) ); kdcReqBody.setRealm( "EXAMPLE.COM" ); kdcReqBody.setEType( config.getEncryptionTypes() ); KdcReq message = new AsReq(); message.setKdcReqBody( kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );