Examples of PaEncTsEnc


Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

        EncryptedData data = new EncryptedData( EncryptionType.AES256_CTS_HMAC_SHA1_96, 0, AES256_ENCRYPTED_TIME_STAMP );

        try
        {
            byte[] paEncTsEncData = lockBox.decrypt( key, data, KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );
            PaEncTsEnc object = KerberosDecoder.decodePaEncTsEnc( paEncTsEncData );
            assertEquals( "TimeStamp", "20070410212809Z", object.getPaTimestamp().toString() );
            assertEquals( "MicroSeconds", 298294, object.getPausec() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

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

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

        EncryptedData encryptedData = null;

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

        try
        {
            byte[] paEncTsEncData = lockBox.decrypt( key, encryptedData, KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );
            PaEncTsEnc object = KerberosDecoder.decodePaEncTsEnc( paEncTsEncData );
            assertEquals( "TimeStamp", "20070410190400Z", object.getPaTimestamp().toString() );
            assertEquals( "MicroSeconds", 460450, object.getPausec() );
        }
        catch ( KerberosException ke )
        {
            fail( "Should not have caught exception." );
        }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

            date = KerberosUtils.UTC_DATE_FORMAT.parse( zuluTime );
        }

        KerberosTime timeStamp = new KerberosTime( date );

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

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

        {
            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
        }

        // get the decoded PaEncTsEnc
        PaEncTsEnc paEncTsEnc = ( ( PaEncTsEncContainer ) paEncTsEncContainer ).getPaEncTsEnc();

        return paEncTsEnc;
    }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        PaEncTsEnc paEncTsEnc = paEncTsEncContainer.getPaEncTsEnc();

        assertEquals( "20101010234545Z", paEncTsEnc.getPaTimestamp().toString() );
        assertEquals( 1, paEncTsEnc.getPausec() );

        ByteBuffer bb = ByteBuffer.allocate( paEncTsEnc.computeLength() );

        try
        {
            bb = paEncTsEnc.encode( bb );

            // Check the length
            assertEquals( 0x1A, bb.limit() );

            String encodedPdu = Strings.dumpBytes( bb.array() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        PaEncTsEnc paEncTsEnc = paEncTsEncContainer.getPaEncTsEnc();

        assertEquals( "20101010234545Z", paEncTsEnc.getPaTimestamp().toString() );
        assertEquals( -1, paEncTsEnc.getPausec() );

        ByteBuffer bb = ByteBuffer.allocate( paEncTsEnc.computeLength() );

        try
        {
            bb = paEncTsEnc.encode( bb );

            // Check the length
            assertEquals( 0x15, bb.limit() );

            String encodedPdu = Strings.dumpBytes( bb.array() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

                    throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_REQUIRED,
                        preparePreAuthenticationError( authContext.getRequest().getKdcReqBody().getEType(),
                            config.getEncryptionTypes() ) );
                }

                PaEncTsEnc timestamp = null;

                for ( PaData paData : preAuthData )
                {
                    if ( paData.getPaDataType().equals( PaDataType.PA_ENC_TIMESTAMP ) )
                    {
                        EncryptedData dataValue = KerberosDecoder.decodeEncryptedData( paData.getPaDataValue() );
                        paData.getPaDataType();
                        byte[] decryptedData = cipherTextHandler.decrypt( clientKey, dataValue,
                            KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );
                        timestamp = KerberosDecoder.decodePaEncTsEnc( decryptedData );
                    }
                }

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

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

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

                /*
 
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

    protected PaData[] getPreAuthEncryptedTimeStamp( EncryptionKey clientKey, KerberosTime timeStamp )
        throws Exception
    {
        PaData[] paData = new PaData[1];

        PaEncTsEnc encryptedTimeStamp = new PaEncTsEnc( timeStamp, 0 );

        EncryptedData encryptedData = lockBox.seal( clientKey, encryptedTimeStamp,
            KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );

        ByteBuffer buffer = ByteBuffer.allocate( encryptedData.computeLength() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

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

        PaEncTsEnc encryptedTimeStamp = new PaEncTsEnc( timeStamp, 0 );

        EncryptionKey clientKey = getEncryptionKey( clientPrincipal, passPhrase, config.getEncryptionTypes() );

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

Examples of org.apache.directory.shared.kerberos.components.PaEncTsEnc

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        PaEncTsEnc paEncTsEnc = paEncTsEncContainer.getPaEncTsEnc();
       
        assertEquals( "20101010234545Z", paEncTsEnc.getPaTimestamp().toString() );
        assertEquals( 1, paEncTsEnc.getPausec() );
       
        ByteBuffer bb = ByteBuffer.allocate( paEncTsEnc.computeLength() );
       
        try
        {
            bb = paEncTsEnc.encode( bb );
   
            // Check the length
            assertEquals( 0x1A, bb.limit() );
   
            String encodedPdu = Strings.dumpBytes(bb.array());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.