Package org.apache.directory.shared.asn1.ber.tlv

Examples of org.apache.directory.shared.asn1.ber.tlv.Value


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

        Value value = tlv.getValue();

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

            if ( pvno != 5 )
            {
                LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes(value.getData()), "The PVNO should be 5" ) );

                // This will generate a PROTOCOL_ERROR
                throw new DecoderException( "The PVNO should be 5" );
            }

            if ( IS_DEBUG )
            {
                LOG.debug( "pvno : {}", pvno );
            }

            setPvno( pvno, container );
        }
        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


        }

        // Get the principalName
        PrincipalName principalName = principalNameContainer.getPrincipalName();

        Value value = tlv.getValue();

        // The PrincipalName must be pure ASCII witout any control character
        if ( KerberosUtils.isKerberosString( value.getData() ) )
        {
            String nameString = Strings.utf8ToString(value.getData());

            principalName.addName( nameString );
            principalNameContainer.setGrammarEndAllowed( true );

            if ( IS_DEBUG )
            {
                LOG.debug( "PrincipalName String : {}", nameString );
            }
        }
        else
        {
            String valBytes = Strings.dumpBytes(value.getData());
            String valStr = Strings.utf8ToString(value.getData());
            String valAll = valBytes + "/" + valStr;
            LOG.error( I18n.err( I18n.ERR_745_NOT_A_KERBEROS_STRING, valAll ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_745_NOT_A_KERBEROS_STRING, valAll ) );
View Full Code Here

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

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

        try
        {
            KerberosTime krbTime = new KerberosTime( date );
View Full Code Here

            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        PaData paData = paDataContainer.getPaData();
        // The PaData's type is an integer
        Value value = tlv.getValue();

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

            paData.setPaDataType( PaDataType.getTypeByValue( paDataType ) );

            if ( IS_DEBUG )
            {
                LOG.debug( "padata-type : {}", paDataType );
            }
        }
        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

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

        // The etype is an integer
        Value value = tlv.getValue();

        EncryptionType etype = null;
        ETypeInfoEntry etypeInfoEntry = eTypeInfoEntryContainer.getETypeInfoEntry();

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

            etypeInfoEntry.setEType( etype );

            if ( IS_DEBUG )
            {
                LOG.debug( "etype : " + etype );
            }

            // The next tag is optional, we can end here
            eTypeInfoEntryContainer.setGrammarEndAllowed( true );
        }
        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

            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        Checksum checksum = checksumContainer.getChecksum();
        // The Checksum's type is an integer
        Value value = tlv.getValue();

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

            checksum.setChecksumType( ChecksumType.getTypeByValue( cksumType ) );

            if ( IS_DEBUG )
            {
                LOG.debug( "cksumType : " + cksumType );
            }
        }
        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

        SearchRequest searchRequest = container.getMessage().getDecorated();

        TLV tlv = container.getCurrentTLV();

        // We have to check that this is a correct scope
        Value value = tlv.getValue();
        int scope = 0;

        try
        {
            scope = IntegerDecoder.parse( value, LdapConstants.SCOPE_BASE_OBJECT,
                LdapConstants.SCOPE_WHOLE_SUBTREE );
        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04101, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setScope( SearchScope.getSearchScope(scope) );
View Full Code Here

               
                if ( type.equals( "int" ) )
                {
                    try
                    {
                        return IntegerDecoder.parse( new Value( (byte[]) obj ) );
                    }
                    catch ( IntegerDecoderException e )
                    {
                        throw new RuntimeException( "Failed to decode INTEGER: " +
                            Strings.dumpBytes( ( byte[] ) obj ), e );
View Full Code Here

        // The current TLV should be a integer
        // We get it and store it in MessageId
        TLV tlv = container.getCurrentTLV();

        Value value = tlv.getValue();

        if ( ( value == null ) || ( value.getData() == null ) )
        {
            String msg = I18n.err( I18n.ERR_04075 );
            LOG.error( msg );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( msg );
        }

        try
        {
            int abandonnedMessageId = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );

            abandonRequest.setAbandoned( abandonnedMessageId );

            if ( IS_DEBUG )
            {
                LOG
                    .debug( "AbandonMessage Id has been decoded : {}", Integer
                        .valueOf( abandonnedMessageId ) );
            }

            container.setGrammarEndAllowed( true );

            return;
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n
                .err( I18n.ERR_04076, Strings.dumpBytes(value.getData()), ide.getMessage() ) );

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

        ETypeInfo2Entry etypeInfo2Entry = eTypeInfo2EntryContainer.getETypeInfo2Entry();

        // The Length may be null
        if ( tlv.getLength() != 0 )
        {
            Value value = tlv.getValue();

            // The encrypted data may be null
            if ( value.getData() != null )
            {
                String salt = Strings.utf8ToString(value.getData());
                etypeInfo2Entry.setSalt( salt );
            }
        }

        if ( IS_DEBUG )
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.ber.tlv.Value

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.