Examples of Asn1Decoder


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

     * Test the decoding of a EncApRepPart message
     */
    @Test
    public void testDecodeFullEncApRepPart() throws Exception
    {
        Asn1Decoder kerberosDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x33 );

        stream.put( new byte[]
            {
                0x7B, 0x31,
                0x30, 0x2F,
                ( byte ) 0xA0, 0x11, // ctime
                0x18,
                0x0F,
                '2',
                '0',
                '1',
                '0',
                '1',
                '1',
                '1',
                '0',
                '1',
                '5',
                '4',
                '5',
                '2',
                '5',
                'Z',
                ( byte ) 0xA1,
                0x03, // cusec
                0x02,
                0x01,
                0x7F,
                ( byte ) 0xA2,
                0x0F, // subkey
                0x30,
                0x0D,
                ( byte ) 0xA0,
                0x03,
                0x02,
                0x01,
                0x01,
                ( byte ) 0xA1,
                0x06,
                0x04,
                0x04,
                'A',
                'B',
                'C',
                'D',
                ( byte ) 0xA3,
                0x04, // seq-number
                0x02,
                0x02,
                0x30,
                0x39,
        } );

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

        // Allocate a EncApRepPart Container
        Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );

        // Decode the EncApRepPart PDU
        try
        {
            kerberosDecoder.decode( stream, encApRepPartContainer );
        }
        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }
View Full Code Here

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

     * Test the decoding of a EncApRepPart with nothing in it
     */
    @Test(expected = DecoderException.class)
    public void testAuthenticatorEmpty() throws DecoderException
    {
        Asn1Decoder kerberosDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x02 );

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

        stream.flip();

        // Allocate a EncApRepPart Container
        Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );

        // Decode the EncApRepPart PDU
        kerberosDecoder.decode( stream, encApRepPartContainer );
        fail();
    }
View Full Code Here

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

     * Test the decoding of a EncApRepPart with empty sequence
     */
    @Test(expected = DecoderException.class)
    public void testEncApRepPartEmptySequence() throws DecoderException
    {
        Asn1Decoder kerberosDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x04 );

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

        stream.flip();

        // Allocate a EncApRepPart Container
        Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );

        // Decode the EncApRepPart PDU
        kerberosDecoder.decode( stream, encApRepPartContainer );
        fail();
    }
View Full Code Here

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

     * Test the decoding of a EncApRepPart with empty ctime tag
     */
    @Test(expected = DecoderException.class)
    public void testEncApRepPartEmptyCTimeg() throws DecoderException
    {
        Asn1Decoder kerberosDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x06 );

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

        stream.flip();

        // Allocate a EncApRepPart Container
        Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );

        // Decode the EncApRepPart PDU
        kerberosDecoder.decode( stream, encApRepPartContainer );
        fail();
    }
View Full Code Here

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

public class StoredProcedureTest
{
    @Test
    public void testDecodeStoredProcedureNParams() throws IntegerDecoderException
    {
        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x44 );

        stream.put( new byte[]
            {
                0x30, 0x42,
                0x04, 0x04, 'J', 'a', 'v', 'a',
                0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
                0x30, 0x31,
                0x30, 0x08,
                0x04, 0x03, 'i', 'n', 't',
                0x04, 0x01, 0x01,
                0x30, 0x0F,
                0x04, 0x07, 'b', 'o', 'o', 'l', 'e', 'a', 'n',
                0x04, 0x04, 't', 'r', 'u', 'e',
                0x30, 0x14,
                0x04, 0x06, 'S', 't', 'r', 'i', 'n', 'g',
                0x04, 0x0A, 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', '3'
        } );

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

        // Allocate a StoredProcedure Container
        StoredProcedureContainer storedProcedureContainer = new StoredProcedureContainer();

        // Decode a StoredProcedure message
        try
        {
            storedProcedureDecoder.decode( stream, storedProcedureContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here

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


    @Test
    public void testDecodeStoredProcedureNoParam()
    {
        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x13 );

        stream.put( new byte[]
            {
                0x30, 0x11,
                0x04, 0x04, 'J', 'a', 'v', 'a',
                0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
                0x30, 0x00
        } );

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

        // Allocate a StoredProcedure Container
        StoredProcedureContainer storedProcedureContainer = new StoredProcedureContainer();

        // Decode a StoredProcedure message
        try
        {
            storedProcedureDecoder.decode( stream, storedProcedureContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here

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


    @Test
    public void testDecodeStoredProcedureOneParam() throws IntegerDecoderException
    {
        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x1D );

        stream.put( new byte[]
            {
                0x30, 0x1B,
                0x04, 0x04, 'J', 'a', 'v', 'a',
                0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
                0x30, 0x0A,
                0x30, 0x08,
                0x04, 0x03, 'i', 'n', 't',
                0x04, 0x01, 0x01,
        } );

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

        // Allocate a StoredProcedure Container
        StoredProcedureContainer storedProcedureContainer = new StoredProcedureContainer();

        // Decode a StoredProcedure message
        try
        {
            storedProcedureDecoder.decode( stream, storedProcedureContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here

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

     * is : (&(|(objectclass=top)(ou=contacts))(!(objectclass=ttt)))
     */
    @Test
    public void testDecodeSearchRequestGlobalNoControls()
    {
        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x90 );
        stream.put( new byte[]
            { 0x30, ( byte ) 0x81,
                ( byte ) 0x8D, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x63,
                ( byte ) 0x81,
                ( byte ) 0x87, // CHOICE { ...,
                // searchRequest SearchRequest, ...
                // SearchRequest ::= APPLICATION[3] SEQUENCE {
                0x04,
                0x1F, // baseObject LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                0x0A,
                0x01,
                0x01, // scope ENUMERATED {
                // baseObject (0),
                // singleLevel (1),
                // wholeSubtree (2) },
                0x0A,
                0x01,
                0x03, // derefAliases ENUMERATED {
                // neverDerefAliases (0),
                // derefInSearching (1),
                // derefFindingBaseObj (2),
                // derefAlways (3) },
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8, // sizeLimit INTEGER (0 .. maxInt), (1000)
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8, // timeLimit INTEGER (0 .. maxInt), (1000)
                0x01,
                0x01,
                ( byte ) 0xFF, // typesOnly  BOOLEAN, (TRUE)
                // filter Filter,
                ( byte ) 0xA0,
                0x3C, // Filter ::= CHOICE {
                // and [0] SET OF Filter,
                ( byte ) 0xA1,
                0x24, // or [1] SET of Filter,
                ( byte ) 0xA3,
                0x12, // equalityMatch [3]
                // Assertion,
                // Assertion ::= SEQUENCE {
                // attributeDesc AttributeDescription (LDAPString),
                0x04,
                0x0B,
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                // assertionValue AssertionValue (OCTET STRING) }
                0x04,
                0x03,
                't',
                'o',
                'p',
                ( byte ) 0xA3,
                0x0E, // equalityMatch [3] Assertion,
                // Assertion ::= SEQUENCE {
                0x04,
                0x02,
                'o',
                'u', // attributeDesc AttributeDescription (LDAPString),
                // assertionValue AssertionValue (OCTET STRING) }
                0x04,
                0x08,
                'c',
                'o',
                'n',
                't',
                'a',
                'c',
                't',
                's',
                ( byte ) 0xA2,
                0x14, // not [2] Filter,
                ( byte ) 0xA3,
                0x12, // equalityMatch [3] Assertion,
                // Assertion ::= SEQUENCE {
                // attributeDesc AttributeDescription (LDAPString),
                0x04,
                0x0B,
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                // assertionValue AssertionValue (OCTET STRING) }
                0x04,
                0x03,
                't',
                't',
                't',
                // attributes AttributeDescriptionList }
                0x30,
                0x15, // AttributeDescriptionList ::= SEQUENCE OF
                // AttributeDescription
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '0', // AttributeDescription ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '1', // AttributeDescription ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '2' // AttributeDescription ::= LDAPString
        } );

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

        // Allocate a BindRequest Container
        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer =
            new LdapMessageContainer<SearchRequestDecorator>( codec );

        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here

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

     * (&(|(objectclass~=top)(ou<=contacts))(!(objectclass>=ttt)))
     */
    @Test
    public void testDecodeSearchRequestCompareFiltersNoControls()
    {
        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x90 );
        stream.put( new byte[]
            { 0x30, ( byte ) 0x81,
                ( byte ) 0x8D, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, //     messageID MessageID
                0x63,
                ( byte ) 0x81,
                ( byte ) 0x87, //     CHOICE { ...,
                //         searchRequest SearchRequest, ...
                // SearchRequest ::= APPLICATION[3] SEQUENCE {
                0x04,
                0x1F, //     baseObject LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                0x0A,
                0x01,
                0x01, //     scope ENUMERATED {
                //         baseObject   (0),
                //         singleLevel  (1),
                //         wholeSubtree (2) },
                0x0A,
                0x01,
                0x03, //     derefAliases ENUMERATED {
                //         neverDerefAliases (0),
                //         derefInSearching (1),
                //         derefFindingBaseObj (2),
                //         derefAlways (3) },
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8, //     sizeLimit INTEGER (0 .. maxInt), (1000)
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8, //     timeLimit INTEGER (0 .. maxInt), (1000)
                0x01,
                0x01,
                ( byte ) 0xFF, //     typesOnly BOOLEAN, (TRUE)
                //     filter Filter,
                ( byte ) 0xA0,
                0x3C, // Filter ::= CHOICE {
                //      and [0] SET OF Filter,
                ( byte ) 0xA1,
                0x24, //      or [1] SET of Filter,
                ( byte ) 0xA8,
                0x12, //      approxMatch [8]
                // Assertion,
                // Assertion ::= SEQUENCE {
                0x04,
                0x0B, // attributeDesc AttributeDescription (LDAPString),
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                0x04,
                0x03, // attributeDesc AttributeDescription (LDAPString),
                't',
                'o',
                'p',
                ( byte ) 0xA6,
                0x0E, // lessOrEqual [3] Assertion,
                0x04,
                0x02, // Assertion ::= SEQUENCE {
                'o',
                'u', // attributeDesc AttributeDescription (LDAPString),
                0x04,
                0x08, // assertionValue AssertionValue (OCTET STRING) }
                'c',
                'o',
                'n',
                't',
                'a',
                'c',
                't',
                's',
                ( byte ) 0xA2,
                0x14, // not [2] Filter,
                ( byte ) 0xA5,
                0x12, // greaterOrEqual [5] Assertion,
                // Assertion ::= SEQUENCE {
                0x04,
                0x0B, // attributeDesc AttributeDescription (LDAPString),
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                0x04,
                0x03,
                't',
                't',
                't', // assertionValue AssertionValue (OCTET STRING) }
                // attributes AttributeDescriptionList }
                0x30,
                0x15, // AttributeDescriptionList ::= SEQUENCE OF
                // AttributeDescription
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '0', // AttributeDescription ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '1', // AttributeDescription ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '2' // AttributeDescription ::= LDAPString
        } );

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

        // Allocate a BindRequest Container
        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer =
            new LdapMessageContainer<SearchRequestDecorator>( codec );

        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here

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

     * (&(|(objectclass=*)(ou=*))(!(objectclass>=ttt)))
     */
    @Test
    public void testDecodeSearchRequestPresentNoControls()
    {
        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x7B );
        stream.put( new byte[]
            { 0x30,
                0x79, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x63,
                0x74, // CHOICE { ..., searchRequest SearchRequest, ...
                // SearchRequest ::= APPLICATION[3] SEQUENCE {
                0x04,
                0x1F, // baseObject LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                0x0A,
                0x01,
                0x01, // scope
                // ENUMERATED
                // {
                // baseObject (0),
                // singleLevel (1),
                // wholeSubtree (2) },
                0x0A,
                0x01,
                0x03, // derefAliases ENUMERATED {
                // neverDerefAliases (0),
                // derefInSearching (1),
                // derefFindingBaseObj (2),
                // derefAlways (3) },
                // sizeLimit INTEGER (0 .. maxInt), (1000)
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8,
                // timeLimit INTEGER (0 .. maxInt), (1000)
                0x02,
                0x02,
                0x03,
                ( byte ) 0xE8,
                0x01,
                0x01,
                ( byte ) 0xFF, // typesOnly
                // BOOLEAN,
                // (TRUE)
                // filter Filter,
                ( byte ) 0xA0,
                0x29, // Filter ::= CHOICE {
                // and [0] SET OF Filter,
                ( byte ) 0xA1,
                0x11, // or [1] SET of Filter,
                ( byte ) 0x87,
                0x0B, // present [7] AttributeDescription,
                // AttributeDescription ::= LDAPString
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                // assertionValue AssertionValue (OCTET STRING) }
                ( byte ) 0x87,
                0x02,
                'o',
                'u', // present [7]
                // AttributeDescription,
                // AttributeDescription ::= LDAPString
                ( byte ) 0xA2,
                0x14, // not [2] Filter,
                ( byte ) 0xA5,
                0x12, // greaterOrEqual [5]
                // Assertion,
                // Assertion ::= SEQUENCE {
                // attributeDesc AttributeDescription (LDAPString),
                0x04,
                0x0B,
                'o',
                'b',
                'j',
                'e',
                'c',
                't',
                'c',
                'l',
                'a',
                's',
                's',
                // assertionValue AssertionValue (OCTET STRING) }
                0x04,
                0x03,
                't',
                't',
                't',
                // attributes AttributeDescriptionList }
                0x30,
                0x15, // AttributeDescriptionList ::= SEQUENCE OF
                // AttributeDescription
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '0', // AttributeDescription
                // ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '1', // AttributeDescription
                // ::= LDAPString
                0x04,
                0x05,
                'a',
                't',
                't',
                'r',
                '2' // AttributeDescription ::=
            // LDAPString
        } );

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

        // Allocate a BindRequest Container
        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer =
            new LdapMessageContainer<SearchRequestDecorator>( codec );

        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.