Package org.apache.directory.shared.asn1

Examples of org.apache.directory.shared.asn1.DecoderException


        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        // Now, let's decode the HostAddress
        Asn1Decoder krbSafeBodyDecoder = new Asn1Decoder();
View Full Code Here


        if ( tlv.getLength() != 15 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        // The value is the KerberosTime
        BerValue value = tlv.getValue();
        String date = Strings.utf8ToString( value.getData() );

        try
        {
            KerberosTime krbTime = new KerberosTime( date );

            if ( IS_DEBUG )
            {
                LOG.debug( "decoded kerberos time is : {}", krbTime );
            }

            setKerberosTime( krbTime, container );
        }
        catch ( IllegalArgumentException iae )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }
    }
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        // Now, let's decode the HostAddress
        Asn1Decoder hostAddressDecoder = new Asn1Decoder();
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();

        BerValue value = tlv.getValue();

        try
        {
            int etype = IntegerDecoder.parse( value );
            EncryptionType encryptionType = EncryptionType.getTypeByValue( etype );

            kdcReqBody.addEType( encryptionType );

            if ( IS_DEBUG )
            {
                LOG.debug( "EncryptionType : {}", encryptionType );
            }
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ), ide
                .getLocalizedMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage() );
        }

        kdcReqBodyContainer.setGrammarEndAllowed( true );
    }
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        TransitedEncodingContainer transitedContainer = new TransitedEncodingContainer();

        // Now, let's decode the TransitedEncoding
View Full Code Here

        if ( tlv.getLength() != 15 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();

        // The value is the KerberosTime
        BerValue value = tlv.getValue();
        String date = Strings.utf8ToString( value.getData() );

        try
        {
            KerberosTime from = new KerberosTime( date );
            kdcReqBody.setFrom( from );

            if ( IS_DEBUG )
            {
                LOG.debug( "From : {}", from );
            }
        }
        catch ( IllegalArgumentException iae )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }
    }
View Full Code Here

        if ( tlv.getLength() != 1 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        BerValue value = tlv.getValue();

        try
        {
            int msgTypeValue = IntegerDecoder.parse( value );

            if ( msgType != null )
            {
                if ( msgType.getValue() == msgTypeValue )
                {
                    LOG.debug( "msg-type : {}", msgType );

                    return;
                }

                String message = I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ) );
                LOG.error( message );

                // This will generate a PROTOCOL_ERROR
                throw new DecoderException( message );
            }
            else
            {
                KerberosMessageType messageType = KerberosMessageType.getTypeByValue( msgTypeValue );

                if ( container instanceof KdcReqContainer )
                {
                    if ( ( ( KdcReqContainer ) container ).getKdcReq().getMessageType() == messageType )
                    {
                        return;
                    }
                }
                else if ( container instanceof KdcRepContainer )
                {
                    if ( ( ( KdcRepContainer ) container ).getKdcRep().getMessageType() == messageType )
                    {
                        return;
                    }
                }

                String message = I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ) );
                LOG.error( message );

                // This will generate a PROTOCOL_ERROR
                throw new DecoderException( message );
            }
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ), ide
                .getLocalizedMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage() );
        }
    }
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        // Now, let's decode the Ticket
        Asn1Decoder ticketDecoder = new Asn1Decoder();
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        // The value is the realm
        BerValue value = tlv.getValue();
        String eText = Strings.utf8ToString( value.getData() );
View Full Code Here

        if ( tlv.getLength() != 15 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();

        // The value is the KerberosTime
        BerValue value = tlv.getValue();
        String date = Strings.utf8ToString( value.getData() );

        try
        {
            KerberosTime till = new KerberosTime( date );
            kdcReqBody.setTill( till );

            if ( IS_DEBUG )
            {
                LOG.debug( "Till : {}", till );
            }
        }
        catch ( IllegalArgumentException iae )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.DecoderException

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.