You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/11/17 23:45:28 UTC

svn commit: r1036265 - in /directory/apacheds/trunk/kerberos-codec/src: main/java/org/apache/directory/shared/kerberos/codec/asRep/ main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/ test/java/org/apache/directory/shared/kerberos/codec/

Author: elecharny
Date: Wed Nov 17 22:45:28 2010
New Revision: 1036265

URL: http://svn.apache.org/viewvc?rev=1036265&view=rev
Log:
Added the AsRep grammar

Added:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepGrammar.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepStatesEnum.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AsRepDecoderTest.java

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java?rev=1036265&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java Wed Nov 17 22:45:28 2010
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.asRep;
+
+import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.kerberos.messages.AsRep;
+
+
+/**
+ * The AS-REP container stores the KdcRep decoded by the Asn1Decoder.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AsRepContainer extends KdcReqContainer
+{
+    /** An AS-REP container */
+    private AsRep asRep;
+
+    /**
+     * Creates a new AsRepContainer object.
+     */
+    public AsRepContainer()
+    {
+        super();
+        this.stateStack = new int[1];
+        this.grammar = AsRepGrammar.getInstance();
+        setTransition( AsRepStatesEnum.START_STATE );
+    }
+
+
+    /**
+     * @return Returns the AsRep.
+     */
+    public AsRep getAsRep()
+    {
+        return asRep;
+    }
+
+    
+    /**
+     * Set an AsRep Object into the container. It will be completed by the
+     * KerberosDecoder.
+     * 
+     * @param asRep The AsRep to set.
+     */
+    public void setAsRep( AsRep asRep )
+    {
+        this.asRep = asRep;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepGrammar.java?rev=1036265&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepGrammar.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepGrammar.java Wed Nov 17 22:45:28 2010
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.asRep;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.Grammar;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.kerberos.KerberosConstants;
+import org.apache.directory.shared.kerberos.codec.asRep.actions.StoreKdcRep;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the AS-REP structure. All the actions are declared
+ * in this class. As it is a singleton, these declaration are only done once. If
+ * an action is to be added or modified, this is where the work is to be done !
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class AsRepGrammar extends AbstractGrammar
+{
+    /** The logger */
+    static final Logger LOG = LoggerFactory.getLogger( AsRepGrammar.class );
+
+    /** A speedup for logger */
+    static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+    /** The instance of grammar. AsRepGrammar is a singleton */
+    private static Grammar instance = new AsRepGrammar();
+
+
+    /**
+     * Creates a new AsRepGrammar object.
+     */
+    private AsRepGrammar()
+    {
+        setName( AsRepGrammar.class.getName() );
+
+        // Create the transitions table
+        super.transitions = new GrammarTransition[AsRepStatesEnum.LAST_AS_REP_STATE.ordinal()][256];
+
+        // ============================================================================================
+        // AS-REP 
+        // ============================================================================================
+        // --------------------------------------------------------------------------------------------
+        // Transition from AS-REP init to KDC-REP
+        // --------------------------------------------------------------------------------------------
+        // AS-REP          ::= [APPLICATION 11] KDC-REP
+        super.transitions[AsRepStatesEnum.START_STATE.ordinal()][KerberosConstants.AS_REP_TAG] = new GrammarTransition(
+            AsRepStatesEnum.START_STATE, AsRepStatesEnum.AS_REP_STATE, KerberosConstants.AS_REP_TAG,
+            new StoreKdcRep() );
+    }
+
+
+    /**
+     * Get the instance of this grammar
+     * 
+     * @return An instance on the AS-REP Grammar
+     */
+    public static Grammar getInstance()
+    {
+        return instance;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepStatesEnum.java?rev=1036265&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepStatesEnum.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepStatesEnum.java Wed Nov 17 22:45:28 2010
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.asRep;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.Grammar;
+import org.apache.directory.shared.asn1.ber.grammar.States;
+import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
+
+
+/**
+ * This class store the AS-REP grammar's constants. It is also used for debugging
+ * purpose
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum AsRepStatesEnum implements States
+{
+    // Start
+    START_STATE,                            // 0
+    
+    // ----- HostAddresses message --------------------------------------
+    AS_REP_STATE,                           // 1
+    
+    // End
+    LAST_AS_REP_STATE;                      // 2
+
+    
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar code
+     * @return The grammar name
+     */
+    public String getGrammarName( int grammar )
+    {
+        return "AS_REP_GRAMMAR";
+    }
+
+
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar class
+     * @return The grammar name
+     */
+    public String getGrammarName( Grammar grammar )
+    {
+        if ( grammar instanceof KerberosMessageGrammar )
+        {
+            return "AS_REP_GRAMMAR";
+        }
+        else
+        {
+            return "UNKNOWN GRAMMAR";
+        }
+    }
+
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public String getState( int state )
+    {
+        return ( ( state == LAST_AS_REP_STATE.ordinal() ) ? "AS_REP_END_STATE" : name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == LAST_AS_REP_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AsRepStatesEnum getStartState()
+    {
+        return START_STATE;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java?rev=1036265&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java Wed Nov 17 22:45:28 2010
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.asRep.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
+import org.apache.directory.shared.kerberos.codec.asRep.AsRepContainer;
+import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
+import org.apache.directory.shared.kerberos.messages.AsRep;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to add a KDC-REP object
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreKdcRep extends GrammarAction
+{
+    /** The logger */
+    private static final Logger LOG = LoggerFactory.getLogger( KerberosMessageGrammar.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+    /**
+     * Instantiates a new KDC-REP action.
+     */
+    public StoreKdcRep()
+    {
+        super( "Add an KDC-REP instance" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void action( Asn1Container container ) throws DecoderException
+    {
+        AsRepContainer asRepContainer = ( AsRepContainer ) container;
+
+        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();
+        kdcRepContainer.setStream( container.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( container.getStream(), kdcRepContainer );
+        }
+        catch ( DecoderException de )
+        {
+            throw de;
+        }
+        
+        // Update the expected length for the current TLV
+        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
+
+        // Update the parent
+        container.updateParent();
+        
+        asRepContainer.setAsRep( asRep );
+
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "AS-REP : {}", asRep );
+        }
+        
+        container.setGrammarEndAllowed( true );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AsRepDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AsRepDecoderTest.java?rev=1036265&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AsRepDecoderTest.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AsRepDecoderTest.java Wed Nov 17 22:45:28 2010
@@ -0,0 +1,237 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.kerberos.codec.asRep.AsRepContainer;
+import org.apache.directory.shared.kerberos.messages.AsRep;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test the decoder for a AS-REP
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class AsRepDecoderTest
+{
+    /**
+     * Test the decoding of a AS-REP message
+     */
+    @Test
+    public void testDecodeFullAsRep() throws Exception
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0xAC );
+        
+        stream.put( new byte[]
+        {
+          0x6B, (byte)0x81, (byte)0xA9,
+            0x30, (byte)0x81, (byte)0xA6,
+              (byte)0xA0, 0x03,                         // PVNO
+                0x02, 0x01, 0x05,
+              (byte)0xA1, 0x03,                         // msg-type
+                0x02, 0x01, 0x0B,
+              (byte)0xA2, 0x20,                         // PA-DATA
+                0x30, 0x1E,
+                  0x30, 0x0D,
+                    (byte)0xA1,0x03,
+                      0x02, 0x01, 01,
+                    (byte)0xA2, 0x06,
+                      0x04, 0x04, 'a', 'b', 'c', 'd',
+                  0x30, 0x0D,
+                    (byte)0xA1,0x03,
+                      0x02, 0x01, 01,
+                    (byte)0xA2, 0x06,
+                      0x04, 0x04, 'e', 'f', 'g', 'h',
+              (byte)0xA3, 0x0D,                         // crealm
+                0x1B, 0x0B, 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+              (byte)0xA4, 0x14,                         // cname
+                0x30, 0x12,
+                  (byte)0xA0, 0x03,                     // name-type
+                    0x02, 0x01, 0x01,
+                  (byte)0xA1, 0x0B,                     // name-string
+                    0x30, 0x09,
+                      0x1B, 0x07, 'h', 'n', 'e', 'l', 's', 'o', 'n',
+              (byte)0xA5, 0x40,                         // Ticket
+                0x61, 0x3E, 
+                  0x30, 0x3C, 
+                    (byte)0xA0, 0x03, 
+                      0x02, 0x01, 0x05, 
+                    (byte)0xA1, 0x0D, 
+                      0x1B, 0x0B, 
+                        'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M', 
+                    (byte)0xA2, 0x13, 
+                      0x30, 0x11, 
+                        (byte)0xA0, 0x03, 
+                          0x02, 0x01, 0x01, 
+                        (byte)0xA1, 0x0A, 
+                          0x30, 0x08, 
+                            0x1B, 0x06, 
+                              'c', 'l', 'i', 'e', 'n', 't', 
+                    (byte)0xA3, 0x11, 
+                      0x30, 0x0F, 
+                        (byte)0xA0, 0x03, 
+                          0x02, 0x01, 0x11, 
+                        (byte)0xA2, 0x08, 
+                          0x04, 0x06, 
+                            'a', 'b', 'c', 'd', 'e', 'f', 
+              (byte)0xA6, 0x11,                         // enc-part
+                0x30, 0x0F, 
+                  (byte)0xA0, 0x03, 
+                    0x02, 0x01, 0x11, 
+                  (byte)0xA2, 0x08, 
+                    0x04, 0x06, 
+                      'a', 'b', 'c', 'd', 'e', 'f', 
+        });
+
+        stream.flip();
+
+        // Allocate a AsRep Container
+        AsRepContainer asRepContainer = new AsRepContainer();
+        asRepContainer.setStream( stream );
+        
+        // Decode the AsRep PDU
+        try
+        {
+            kerberosDecoder.decode( stream, asRepContainer );
+        }
+        catch ( DecoderException de )
+        {
+            fail( de.getMessage() );
+        }
+
+        AsRep asRep = asRepContainer.getAsRep();
+        
+        // Check the encoding
+        int length = asRep.computeLength();
+
+        // Check the length
+        assertEquals( 0xAC, length );
+        
+        // Check the encoding
+        ByteBuffer encodedPdu = ByteBuffer.allocate( length );
+        
+        try
+        {
+            encodedPdu = asRep.encode( encodedPdu );
+            
+            // Check the length
+            assertEquals( 0xAC, encodedPdu.limit() );
+        }
+        catch ( EncoderException ee )
+        {
+            fail();
+        }
+    }
+    
+    
+    /**
+     * Test the decoding of a AS-REP with nothing in it
+     */
+    @Test( expected = DecoderException.class)
+    public void testAsRepEmpty() throws DecoderException
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x02 );
+        
+        stream.put( new byte[]
+            { 0x30, 0x00 } );
+
+        stream.flip();
+
+        // Allocate a AS-REP Container
+        Asn1Container asRepContainer = new AsRepContainer();
+
+        // Decode the AS-REP PDU
+        kerberosDecoder.decode( stream, asRepContainer );
+        fail();
+    }
+    
+    
+    /**
+     * Test the decoding of a AS-REP with empty Pvno tag
+     */
+    @Test( expected = DecoderException.class)
+    public void testAsRepEmptyPvnoTag() throws DecoderException
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x04 );
+        
+        stream.put( new byte[]
+            { 
+                0x30, 0x02,
+                  (byte)0xA0, 0x00
+            } );
+
+        stream.flip();
+
+        // Allocate a AS-REP Container
+        Asn1Container asRepContainer = new AsRepContainer();
+
+        // Decode the AS-REP PDU
+        kerberosDecoder.decode( stream, asRepContainer );
+        fail();
+    }
+    
+    
+    /**
+     * Test the decoding of a AS-REP with empty Pvno value
+     */
+    @Test( expected = DecoderException.class)
+    public void testAsRepEmptyPvnoValue() throws DecoderException
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x06 );
+        
+        stream.put( new byte[]
+            { 
+                0x30, 0x04,
+                  (byte)0xA0, 0x02,
+                    0x02, 0x00
+            } );
+
+        stream.flip();
+
+        // Allocate a AS-REP Container
+        Asn1Container asRepContainer = new AsRepContainer();
+
+        // Decode the AS-REP PDU
+        kerberosDecoder.decode( stream, asRepContainer );
+        fail();
+    }
+}