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

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


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

        // decoder for Ticket
        Asn1Decoder decoder = new Asn1Decoder();

        // Ticket container
        TicketContainer ticketContainer = new TicketContainer( krbCredContainer.getStream() );

        krbCredContainer.rewind();

        try
        {
            // decode Ticket
            decoder.decode( krbCredContainer.getStream(), ticketContainer );
        }
        catch ( DecoderException e )
        {
            throw e;
        }

        Ticket ticket = ticketContainer.getTicket();
        // add Ticket to the list of tickets
        krbCredContainer.getKrbCred().addTicket( ticket );

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

        // Update the parent
        krbCredContainer.updateParent();

        if ( IS_DEBUG )
View Full Code Here

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

        // The Length can be null, in this case, we can potentially exit from this grammar
        if ( tlv.getLength() == 0 )
        {
            kdcReqBodyContainer.setGrammarEndAllowed( true );
        }
    }
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( 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( 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 ) );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( TgsReqContainer tgsReqContainer ) throws DecoderException
    {
        TLV tlv = tgsReqContainer.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-REQ
        Asn1Decoder kdcReqDecoder = new Asn1Decoder();

        KdcReqContainer kdcReqContainer = new KdcReqContainer( tgsReqContainer.getStream() );

        // Store the created TGS-REQ object into the KDC-REQ container
        TgsReq tgsReq = new TgsReq();
        kdcReqContainer.setKdcReq( tgsReq );

        // Decode the KDC_REQ PDU
        try
        {
            kdcReqDecoder.decode( tgsReqContainer.getStream(), kdcReqContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        tgsReqContainer.updateParent();

        if ( tgsReq.getMessageType() != KerberosMessageType.TGS_REQ )
View Full Code Here

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

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

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

        // Update the parent
        encAsRepPartContainer.updateParent();

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

    /**
     * {@inheritDoc}
     */
    public void action( KrbSafeContainer krbSafeContainer ) throws DecoderException
    {
        TLV tlv = krbSafeContainer.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 krbSafeBodyDecoder = new Asn1Decoder();

        KrbSafeBodyContainer krbSafeBodyContainer = new KrbSafeBodyContainer();

        // Passes the Stream to the decoder
        krbSafeBodyContainer.setStream( krbSafeContainer.getStream() );

        // Decode the KrbSafeBody PDU
        try
        {
            krbSafeBodyDecoder.decode( krbSafeContainer.getStream(), krbSafeBodyContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        // Store the KrbSafeBody in the container
        KrbSafeBody krbSafeBody = krbSafeBodyContainer.getKrbSafeBody();

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

        krbSafeContainer.getKrbSafe().setSafeBody( krbSafeBody );

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

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

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