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

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


    /**
     * {@inheritDoc}
     */
    public void action( MethodDataContainer methodDataContainer ) throws DecoderException
    {
        TLV tlv = methodDataContainer.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 PA-DATA
        Asn1Decoder paDataDecoder = new Asn1Decoder();

        PaDataContainer paDataContainer = new PaDataContainer();
        paDataContainer.setStream( methodDataContainer.getStream() );

        // Compute the start position in the stream for the PA-DATA to decode :
        // We have to move back to the PA-DATA tag
        methodDataContainer.rewind();

        // Decode the PA-DATA PDU
        try
        {
            paDataDecoder.decode( methodDataContainer.getStream(), paDataContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        methodDataContainer.updateParent();

        // Store the PA-DATA in the container
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void action( ChecksumContainer checksumContainer ) throws DecoderException
    {
        TLV tlv = checksumContainer.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 ) );
        }

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

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

View Full Code Here

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

        // The Length should not be null
        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );

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

    /**
     * {@inheritDoc}
     */
    public void action( TypedDataContainer typedDataContainer ) throws DecoderException
    {
        TLV tlv = typedDataContainer.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( PrincipalNameContainer principalNameContainer ) throws DecoderException
    {
        TLV tlv = principalNameContainer.getCurrentTLV();

        // The Length should not be null
        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );

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

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

        BerValue value = tlv.getValue();

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

    /**
     * {@inheritDoc}
     */
    public void action( ETypeInfoContainer eTypeInfoContainer ) throws DecoderException
    {
        TLV tlv = eTypeInfoContainer.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 ETYPE-INFO-ENTRY
        Asn1Decoder etypeInfoEntryDecoder = new Asn1Decoder();

        ETypeInfoEntryContainer etypeInfoEntryContainer = new ETypeInfoEntryContainer();
        etypeInfoEntryContainer.setStream( eTypeInfoContainer.getStream() );

        // Compute the start position in the stream for the ETypeInfoEntry to decode :
        // We have to move back to the ETypeInfoEntry tag
        eTypeInfoContainer.rewind();

        // Decode the ETypeInfoEntry PDU
        try
        {
            etypeInfoEntryDecoder.decode( eTypeInfoContainer.getStream(), etypeInfoEntryContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        eTypeInfoContainer.updateParent();

        // Store the ETypeInfoEntry in the container
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 ) );
        }

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

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

        try
View Full Code Here

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

        // The Length can't 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 PA-DATA
        Asn1Decoder paDataDecoder = new Asn1Decoder();

        PaDataContainer paDataContainer = new PaDataContainer();
        paDataContainer.setStream( kdcRepContainer.getStream() );

        // We have to move back to the PA-DATA tag
        kdcRepContainer.rewind();

        // Decode the PA-DATA PDU
        try
        {
            paDataDecoder.decode( kdcRepContainer.getStream(), paDataContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        // Update the parent
        kdcRepContainer.updateParent();

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

        // Store the PData in the container
        PaData paData = paDataContainer.getPaData();
        KdcRep kdcRep = kdcRepContainer.getKdcRep();
        kdcRep.addPaData( paData );
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

    /**
     * {@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 ) );
        }

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

        if ( IS_DEBUG )
        {
            LOG.debug( "read realm value : " + realm );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.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.