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

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


    /**
     * {@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 final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null and should be 1
        if ( tlv.getLength() != 1 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

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

        BerValue value = tlv.getValue();

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

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 final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null and should be 15
        if ( tlv.getLength() != 15 )
        {
            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 KerberosTime
        BerValue value = tlv.getValue();
        String date = Strings.utf8ToString( value.getData() );

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

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

        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();

        BerValue value = tlv.getValue();

        try
        {
            int etype = IntegerDecoder.parse( value );
            EncryptionType encryptionType = EncryptionType.getTypeByValue( etype );
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 void action( EncTicketPartContainer encTicketPartContainer ) throws DecoderException
    {
        TLV tlv = encTicketPartContainer.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 ) );
        }

        TransitedEncodingContainer transitedContainer = new TransitedEncodingContainer();

        // Now, let's decode the TransitedEncoding
        Asn1Decoder transitedEncodingDecoder = new Asn1Decoder();

        try
        {
            transitedEncodingDecoder.decode( encTicketPartContainer.getStream(), transitedContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

        TransitedEncoding te = transitedContainer.getTransitedEncoding();

        if ( IS_DEBUG )
        {
            LOG.debug( "TransitedEncoding {}", te );
        }

        encTicketPartContainer.getEncTicketPart().setTransited( te );

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

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

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

        // The Length should not be null and should be 15
        if ( tlv.getLength() != 15 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

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

        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();

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

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

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

        // The Length should not be null and should be 1
        if ( tlv.getLength() != 1 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

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

        BerValue value = tlv.getValue();

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

View Full Code Here

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

        // We have to move back to the Ticket tag
        kdcReqBodyContainer.rewind();

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

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

        // Update the parent
        kdcReqBodyContainer.updateParent();

        // Store the Ticket in the container
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.