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

Examples of org.apache.directory.api.asn1.ber.Asn1Decoder


     * Test the decoding of a full ETYPE-INFO2-ENTRY
     */
    @Test
    public void testDecodeETypeInfoEntry()
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x17 );

        stream.put( new byte[]
            {
                0x30, 0x15,
                ( byte ) 0xA0, 0x03, // etype
                0x02,
                0x01,
                0x05,
                ( byte ) 0xA1,
                0x06, // salt
                0x1B,
                0x04,
                'a',
                'b',
                'c',
                'd',
                ( byte ) 0xA2,
                0x06, // s2kparams
                0x04,
                0x04,
                0x31,
                0x32,
                0x33,
                0x34
        } );

        String decodedPdu = Strings.dumpBytes( stream.array() );
        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        try
        {
            krbDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();

View Full Code Here


     * Test the decoding of a ETYPE-INFO2-ENTRY with no salt nor s2kparams
     */
    @Test
    public void testDecodeETypeInfo2EntryNoSaltNoS2KParams()
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x07 );

        stream.put( new byte[]
            {
                0x30, 0x05,
                ( byte ) 0xA0, 0x03, // etype
                0x02,
                0x01,
                0x05
        } );

        String decodedPdu = Strings.dumpBytes( stream.array() );
        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        try
        {
            krbDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();

View Full Code Here

     * Test the decoding of a ETYPE-INFO2-ENTRY with an empty salt
     */
    @Test(expected = DecoderException.class)
    public void testDecodeETypeInfo2EntryEmptySalt() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x09 );

        stream.put( new byte[]
            {
                0x30, 0x07,
                ( byte ) 0xA0, 0x03, // etype
                0x02,
                0x01,
                0x05,
                ( byte ) 0xA1,
                0x00 // salt
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        krbDecoder.decode( stream, container );
        fail();
    }
View Full Code Here

     * Test the decoding of a ETYPE-INFO2-ENTRY with an null salt
     */
    @Test
    public void testDecodeETypeInfo2EntryNullSalt()
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x0B );

        stream.put( new byte[]
            {
                0x30, 0x09,
                ( byte ) 0xA0, 0x03, // etype
                0x02,
                0x01,
                0x05,
                ( byte ) 0xA1,
                0x02, // salt
                0x1B,
                0x00
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        try
        {
            krbDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();

View Full Code Here

                passwordData = new ChangePasswdData();
                passwordData.setNewPasswd( privatePart.getUserData() );
            }
            else
            {
                Asn1Decoder passwordDecoder = new Asn1Decoder();
                ByteBuffer stream = ByteBuffer.wrap( privatePart.getUserData() );
                ChangePasswdDataContainer container = new ChangePasswdDataContainer( stream );
                passwordDecoder.decode( stream, container );
                passwordData = container.getChngPwdData();
            }
        }
        catch ( KerberosException ke )
        {
View Full Code Here

     * @throws DecoderException
     */
    @Test(expected = DecoderException.class)
    public void testDecodeEmptyETypeInfo2Entry() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x02 );

        stream.put( new byte[]
            {
                0x30, 0x00
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        krbDecoder.decode( stream, container );
        fail();
    }
View Full Code Here

     * @throws DecoderException
     */
    @Test(expected = DecoderException.class)
    public void testDecodeEmptyETypeInfo2EntryNoEType() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x06 );

        stream.put( new byte[]
            {
                0x30, 0x04,
                ( byte ) 0xA2, 0x04,
                0x04, 0x00
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        krbDecoder.decode( stream, container );
        fail();
    }
View Full Code Here

     * @throws DecoderException
     */
    @Test(expected = DecoderException.class)
    public void testDecodeEmptyETypeInfo2EntryEmptyEType() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x06 );

        stream.put( new byte[]
            {
                0x30, 0x04,
                ( byte ) 0xA0, 0x00
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        krbDecoder.decode( stream, container );
        fail();
    }
View Full Code Here

     * @throws DecoderException
     */
    @Test(expected = DecoderException.class)
    public void testDecodeEmptyETypeInfo2EntryEmptyETypeTag() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x06 );

        stream.put( new byte[]
            {
                0x30, 0x04,
                ( byte ) 0xA0, 0x02,
                0x02, 0x00
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        krbDecoder.decode( stream, container );
        fail();
    }
View Full Code Here

     * @throws DecoderException
     */
    @Test
    public void testDecodeEmptyETypeInfo2EntryBadEType() throws DecoderException
    {
        Asn1Decoder krbDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x07 );

        stream.put( new byte[]
            {
                0x30, 0x05,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x40
        } );

        stream.flip();

        ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();

        try
        {
            krbDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();

View Full Code Here

TOP

Related Classes of org.apache.directory.api.asn1.ber.Asn1Decoder

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.