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

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


    /**
     * {@inheritDoc}
     */
    public final void action( EncKdcRepPartContainer encKdcRepPartContainer ) throws DecoderException
    {
        TLV tlv = encKdcRepPartContainer.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 LastReq
        Asn1Decoder lastReqDecoder = new Asn1Decoder();

        LastReqContainer lastReqContainer = new LastReqContainer();

        // Decode the LastReq PDU
        try
        {
            lastReqDecoder.decode( encKdcRepPartContainer.getStream(), lastReqContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        LastReq lastReq = lastReqContainer.getLastReq();

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

        encKdcRepPartContainer.getEncKdcRepPart().setLastReq( lastReq );

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

        // Update the parent
        encKdcRepPartContainer.updateParent();
    }
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 Ticket
        Asn1Decoder ticketDecoder = new Asn1Decoder();

        TicketContainer ticketContainer = new TicketContainer( kdcRepContainer.getStream() );

        // Decode the Ticket PDU
        try
        {
            ticketDecoder.decode( kdcRepContainer.getStream(), ticketContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        kdcRepContainer.updateParent();

        // Store the Ticket in the container
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( AuthenticatorContainer authenticatorContainer ) throws DecoderException
    {
        TLV tlv = authenticatorContainer.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( TransitedEncodingContainer transitedEncodingContainer ) throws DecoderException
    {
        TLV tlv = transitedEncodingContainer.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 ) );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( AsRepContainer asRepContainer ) throws DecoderException
    {
        TLV tlv = asRepContainer.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 KDC-REP
        Asn1Decoder kdcRepDecoder = new Asn1Decoder();

        KdcRepContainer kdcRepContainer = new KdcRepContainer( asRepContainer.getStream() );

        // Store the created AS-REP object into the KDC-REP container
        AsRep asRep = new AsRep();
        kdcRepContainer.setKdcRep( asRep );

        // Decode the KDC_REP PDU
        try
        {
            kdcRepDecoder.decode( asRepContainer.getStream(), kdcRepContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        asRepContainer.updateParent();

        if ( asRep.getMessageType() != KerberosMessageType.AS_REP )
View Full Code Here

    /**
     * {@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( EncTgsRepPartContainer encTgsRepPartContainer ) throws DecoderException
    {
        TLV tlv = encTgsRepPartContainer.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 EncKdcRepPart
        Asn1Decoder encKdcRepPartDecoder = new Asn1Decoder();

        EncKdcRepPartContainer encKdcRepPartContainer = new EncKdcRepPartContainer( encTgsRepPartContainer.getStream() );

        // Decode the EncKdcRepPart PDU
        try
        {
            encKdcRepPartDecoder.decode( encTgsRepPartContainer.getStream(), encKdcRepPartContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        encTgsRepPartContainer.updateParent();

        EncKdcRepPart encKdcRepPart = encKdcRepPartContainer.getEncKdcRepPart();
View Full Code Here

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

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.