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

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


    /**
     * {@inheritDoc}
     */
    public final void action( KrbErrorContainer krbErrorContainer ) throws DecoderException
    {
        TLV tlv = krbErrorContainer.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 eText = Strings.utf8ToString( value.getData() );

        KrbError krbError = krbErrorContainer.getKrbError();
        krbError.setEText( eText );

View Full Code Here


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

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

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

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

        // Update the parent
        hostAddressesContainer.updateParent();

        // Store the hostAddress in the container
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 till = new KerberosTime( date );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( ApReqContainer apReqContainer ) throws DecoderException
    {
        TLV tlv = apReqContainer.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( ETypeInfo2Container eTypeInfo2Container ) throws DecoderException
    {
        TLV tlv = eTypeInfo2Container.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-INFO2-ENTRY
        Asn1Decoder etypeInfo2EntryDecoder = new Asn1Decoder();

        ETypeInfo2EntryContainer etypeInfo2EntryContainer = new ETypeInfo2EntryContainer();
        etypeInfo2EntryContainer.setStream( eTypeInfo2Container.getStream() );

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

        // Decode the ETypeInfo2Entry PDU
        try
        {
            etypeInfo2EntryDecoder.decode( eTypeInfo2Container.getStream(), etypeInfo2EntryContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        eTypeInfo2Container.updateParent();

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

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

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

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

        // Update the parent
        apReqContainer.updateParent();

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

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

        // Store the created TGS-REP object into the KDC-REP container
        TgsRep tgsRep = new TgsRep();
        kdcRepContainer.setKdcRep( tgsRep );

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

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

        // Update the parent
        tgsRepContainer.updateParent();

        if ( tgsRep.getMessageType() != KerberosMessageType.TGS_REP )
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( ETypeInfo2EntryContainer eTypeInfo2EntryContainer ) throws DecoderException
    {
        TLV tlv = eTypeInfo2EntryContainer.getCurrentTLV();
        ETypeInfo2Entry etypeInfo2Entry = eTypeInfo2EntryContainer.getETypeInfo2Entry();

        // The Length may be null
        if ( tlv.getLength() != 0 )
        {
            BerValue value = tlv.getValue();

            // The encrypted data may be null
            if ( value.getData() != null )
            {
                String salt = Strings.utf8ToString( value.getData() );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( ETypeInfo2EntryContainer eTypeInfo2EntryContainer ) throws DecoderException
    {
        TLV tlv = eTypeInfo2EntryContainer.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;
        ETypeInfo2Entry etypeInfo2Entry = eTypeInfo2EntryContainer.getETypeInfo2Entry();

        try
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.