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

Examples of org.apache.directory.api.asn1.ber.tlv.TLV


    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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 Checksum
        Asn1Decoder checksumDecoder = new Asn1Decoder();

        ChecksumContainer checksumContainer = new ChecksumContainer();

        // Decode the Checksum PDU
        try
        {
            checksumDecoder.decode( container.getStream(), checksumContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        Checksum checksum = checksumContainer.getChecksum();

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

        setChecksum( checksum, container );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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 AuthorizationData
        Asn1Decoder authorizationDataDecoder = new Asn1Decoder();

        AuthorizationDataContainer authorizationDataContainer = new AuthorizationDataContainer();

        // Decode the AuthorizationData PDU
        try
        {
            authorizationDataDecoder.decode( container.getStream(), authorizationDataContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        AuthorizationData authorizationData = authorizationDataContainer.getAuthorizationData();

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

        setAuthorizationData( authorizationData, container );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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();

        HostAddressContainer hostAddressContainer = new HostAddressContainer();

        // Passes the Stream to the decoder
        hostAddressContainer.setStream( container.getStream() );

        // Decode the HostAddress PDU
        try
        {
            hostAddressDecoder.decode( container.getStream(), hostAddressContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        // Store the HostAddress in the container
        HostAddress hostAddress = hostAddressContainer.getHostAddress();

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();

        setAddress( hostAddress, container );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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 EncryptionKey
        Asn1Decoder encryptionKeyDecoder = new Asn1Decoder();

        EncryptionKeyContainer encryptionKeyContainer = new EncryptionKeyContainer();

        // Decode the EncryptionKey PDU
        try
        {
            encryptionKeyDecoder.decode( container.getStream(), encryptionKeyContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        EncryptionKey encryptionKey = encryptionKeyContainer.getEncryptionKey();

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

        setEncryptionKey( encryptionKey, container );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( PaEncTsEncContainer paEncTsEncContainer ) throws DecoderException
    {
        TLV tlv = paEncTsEncContainer.getCurrentTLV();

        // The Length should not be null
        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 ) );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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 PrincipalName
        Asn1Decoder encryptedDataDecoder = new Asn1Decoder();

        EncryptedDataContainer encryptedDataContainer = new EncryptedDataContainer();
        encryptedDataContainer.setStream( container.getStream() );

        // Decode the Ticket PDU
        try
        {
            encryptedDataDecoder.decode( container.getStream(), encryptedDataContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        EncryptedData encryptedData = encryptedDataContainer.getEncryptedData();

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

        setEncryptedData( encryptedData, container );

        // Update the TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();

        container.setGrammarEndAllowed( true );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        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 PrincipalName
        Asn1Decoder principalNameDecoder = new Asn1Decoder();

        PrincipalNameContainer principalNameContainer = new PrincipalNameContainer();

        // Decode the PrincipalName PDU
        try
        {
            principalNameDecoder.decode( container.getStream(), principalNameContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        PrincipalName principalName = principalNameContainer.getPrincipalName();

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

        setPrincipalName( principalName, container );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );

        // Update the parent
        container.updateParent();
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( ETypeInfoEntryContainer eTypeInfoEntryContainer ) throws DecoderException
    {
        TLV tlv = eTypeInfoEntryContainer.getCurrentTLV();

        // The Length should not be null
        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 ) );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( KrbCredInfoContainer krbCredInfoContainer ) throws DecoderException
    {
        TLV tlv = krbCredInfoContainer.getCurrentTLV();

        // The Length should not be null
        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 ) );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( PaDataContainer paDataContainer ) throws DecoderException
    {
        TLV tlv = paDataContainer.getCurrentTLV();

        // The Length should not be null
        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 ) );
        }

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

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

View Full Code Here

TOP

Related Classes of org.apache.directory.api.asn1.ber.tlv.TLV

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.