Package org.apache.directory.server.kerberos.shared.messages.value

Examples of org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp


    protected PaData[] getPreAuthEncryptedTimeStamp( KerberosPrincipal clientPrincipal,
        String passPhrase, KerberosTime timeStamp ) throws Exception
    {
        PaData[] paData = new PaData[1];

        EncryptedTimeStamp encryptedTimeStamp = new EncryptedTimeStamp( timeStamp, 0 );

        EncryptionKey clientKey = getEncryptionKey( clientPrincipal, passPhrase );

        EncryptedData encryptedData = lockBox.seal( clientKey, encryptedTimeStamp, KeyUsage.NUMBER1 );
View Full Code Here


                {
                    throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_REQUIRED,
                        preparePreAuthenticationError( config.getEncryptionTypes() ) );
                }

                EncryptedTimeStamp timestamp = null;

                for ( int ii = 0; ii < preAuthData.length; ii++ )
                {
                    if ( preAuthData[ii].getPaDataType().equals( PaDataType.PA_ENC_TIMESTAMP ) )
                    {
                        EncryptedData dataValue;

                        try
                        {
                            dataValue = EncryptedDataDecoder.decode( preAuthData[ii].getPaDataValue() );
                        }
                        catch ( IOException ioe )
                        {
                            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, ioe );
                        }
                        catch ( ClassCastException cce )
                        {
                            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, cce );
                        }

                        timestamp = ( EncryptedTimeStamp ) cipherTextHandler.unseal( EncryptedTimeStamp.class,
                            clientKey, dataValue, KeyUsage.NUMBER1 );
                    }
                }

                if ( preAuthData.length > 0 && timestamp == null )
                {
                    throw new KerberosException( ErrorType.KDC_ERR_PADATA_TYPE_NOSUPP );
                }

                if ( timestamp == null )
                {
                    throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_REQUIRED,
                        preparePreAuthenticationError( config.getEncryptionTypes() ) );
                }

                if ( !timestamp.getTimeStamp().isInClockSkew( config.getAllowableClockSkew() ) )
                {
                    throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_FAILED );
                }

                /*
 
View Full Code Here

        EncryptionKey key = new EncryptionKey( EncryptionType.AES256_CTS_HMAC_SHA1_96, kerberosKey.getEncoded() );

        String zuluTime = "20070410190400Z";
        int microSeconds = 460450;
        EncryptedTimeStamp encryptedTimeStamp = getEncryptedTimeStamp( zuluTime, microSeconds );

        EncryptedData encryptedData = null;

        try
        {
            encryptedData = lockBox.seal( key, encryptedTimeStamp, KeyUsage.NUMBER1 );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }

        Class hint = EncryptedTimeStamp.class;

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, encryptedData,
                KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", "20070410190400Z", object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", 460450, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

            date = dateFormat.parse( zuluTime );
        }

        KerberosTime timeStamp = new KerberosTime( date );

        return new EncryptedTimeStamp( timeStamp, microSeconds );
    }
View Full Code Here

            /*
             * Decrypt the EncryptedData structure to get the PA-ENC-TS-ENC.  Decode the
             * decrypted timestamp into our timestamp object.
             */
            EncryptedTimeStamp timestamp = ( EncryptedTimeStamp ) cipherTextHandler.unseal( EncryptedTimeStamp.class,
                key, sadValue, KeyUsage.NUMBER1 );

            /*
             * Since we got here we must have a valid timestamp structure that we can
             * validate to be within a five minute skew.
             */
            KerberosTime time = timestamp.getTimeStamp();

            if ( time.isInClockSkew( FIVE_MINUTES ) )
            {
                return true;
            }
View Full Code Here

        EncryptionKey key = new EncryptionKey( EncryptionType.DES_CBC_MD5, kerberosKey.getEncoded() );
        EncryptedData data = new EncryptedData( EncryptionType.DES_CBC_MD5, 0, desEncryptedTimeStamp );

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, data, KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", "20070322233107Z", object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", 291067, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

        EncryptionKey key = new EncryptionKey( EncryptionType.DES3_CBC_SHA1_KD, kerberosKey.getEncoded() );
        EncryptedData data = new EncryptedData( EncryptionType.DES3_CBC_SHA1_KD, 0, tripleDesEncryptedTimeStamp );

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, data, KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", "20070410190400Z", object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", 460450, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

        KerberosKey kerberosKey = new KerberosKey( principal, "secret".toCharArray(), algorithm );
        EncryptionKey key = new EncryptionKey( EncryptionType.DES3_CBC_SHA1_KD, kerberosKey.getEncoded() );

        String zuluTime = "20070410190400Z";
        int microSeconds = 460450;
        EncryptedTimeStamp encryptedTimeStamp = getEncryptedTimeStamp( zuluTime, microSeconds );

        EncryptedData encryptedData = null;

        try
        {
            encryptedData = lockBox.seal( key, encryptedTimeStamp, KeyUsage.NUMBER1 );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }

        Class hint = EncryptedTimeStamp.class;

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, encryptedData,
                KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", zuluTime, object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", microSeconds, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

        EncryptionKey key = new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, kerberosKey.getEncoded() );
        EncryptedData data = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, 0, aes128EncryptedTimeStamp );

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, data, KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", "20070410212557Z", object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", 379386, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

        KerberosKey kerberosKey = new KerberosKey( principal, "secret".toCharArray(), "AES128" );
        EncryptionKey key = new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, kerberosKey.getEncoded() );

        String zuluTime = "20070410190400Z";
        int microSeconds = 460450;
        EncryptedTimeStamp encryptedTimeStamp = getEncryptedTimeStamp( zuluTime, microSeconds );

        EncryptedData encryptedData = null;

        try
        {
            encryptedData = lockBox.seal( key, encryptedTimeStamp, KeyUsage.NUMBER1 );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }

        Class hint = EncryptedTimeStamp.class;

        try
        {
            EncryptedTimeStamp object = ( EncryptedTimeStamp ) lockBox.unseal( hint, key, encryptedData,
                KeyUsage.NUMBER1 );
            assertEquals( "TimeStamp", "20070410190400Z", object.getTimeStamp().toString() );
            assertEquals( "MicroSeconds", 460450, object.getMicroSeconds() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.