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

Examples of org.apache.directory.api.asn1.ber.grammar.GrammarTransition



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

        ByteBuffer stream = ByteBuffer.allocate( 0x0C );

        stream.put( new byte[]
            {
                0x30, 0x0A,
                ( byte ) 0xA1, 0x08, // keyvalue
                0x04,
                0x06,
                'k',
                'e',
                'y',
                'v',
                'a',
                'l'
        } );

        stream.flip();

        EncryptionKeyContainer chkContainer = new EncryptionKeyContainer();

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



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

        ByteBuffer stream = ByteBuffer.allocate( 0x07 );

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

        stream.flip();

        EncryptionKeyContainer container = new EncryptionKeyContainer();

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


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

        ByteBuffer stream = ByteBuffer.allocate( 0x09 );

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

        stream.flip();

        EncryptionKeyContainer container = new EncryptionKeyContainer();

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


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

        ByteBuffer stream = ByteBuffer.allocate( 0x0B );

        stream.put( new byte[]
            {
                0x30, 0x09,
                ( byte ) 0xA0, 0x03, // keytype
                0x02,
                0x01,
                0x02,
                ( byte ) 0xA1,
                0x02,
                0x04,
                0x00
        } );

        stream.flip();

        EncryptionKeyContainer container = new EncryptionKeyContainer();

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

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

        ByteBuffer stream = ByteBuffer.allocate( 0xA2 );

        stream.put( new byte[]
            {
                0x7A, ( byte ) 0x81, ( byte ) 0x9F,
                0x30, ( byte ) 0x81, ( byte ) 0x9C,
                ( byte ) 0xA0, 0x11,
                0x30, 0x0F,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x11,
                ( byte ) 0xA1, 0x08,
                0x04, 0x06,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
                ( byte ) 0xA1, 0x36,
                0x30, 0x34,
                0x30, 0x18,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x02,
                ( byte ) 0xA1, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                0x30, 0x18,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x02,
                ( byte ) 0xA1, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA2, 0x03,
                0x02, 0x01, 0x01,
                ( byte ) 0xA4, 0x07,
                0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
                ( byte ) 0xA5, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA7, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA9, 0x06,
                0x1B, 0x04, 'a', 'b', 'c', 'd',
                ( byte ) 0xAA, 0x13,
                0x30, 0x11,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x01,
                ( byte ) 0xA1, 0x0A,
                0x30, 0x08,
                0x1B, 0x06,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
        } );

        stream.flip();

        // Allocate a EncAsRepPart Container
        EncTgsRepPartContainer encTgsRepPartContainer = new EncTgsRepPartContainer( stream );

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

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

        ByteBuffer stream = ByteBuffer.allocate( 0x02 );

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

        stream.flip();

        // Allocate a EncTgsRepPart Container
        Asn1Container encTgsRepPartContainer = new EncTgsRepPartContainer( stream );

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

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

        ByteBuffer stream = ByteBuffer.allocate( 0x04 );

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

        stream.flip();

        // Allocate a EncTgsRepPart Container
        Asn1Container encTgsRepPartContainer = new EncTgsRepPartContainer( stream );

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

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

        ByteBuffer stream = ByteBuffer.allocate( 0xA2 );

        stream.put( new byte[]
            {
                0x79, ( byte ) 0x81, ( byte ) 0x9F,
                0x30, ( byte ) 0x81, ( byte ) 0x9C,
                ( byte ) 0xA0, 0x11,
                0x30, 0x0F,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x11,
                ( byte ) 0xA1, 0x08,
                0x04, 0x06,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
                ( byte ) 0xA1, 0x36,
                0x30, 0x34,
                0x30, 0x18,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x02,
                ( byte ) 0xA1, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                0x30, 0x18,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x02,
                ( byte ) 0xA1, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA2, 0x03,
                0x02, 0x01, 0x01,
                ( byte ) 0xA4, 0x07,
                0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
                ( byte ) 0xA5, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA7, 0x11,
                0x18, 0x0F,
                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
                ( byte ) 0xA9, 0x06,
                0x1B, 0x04, 'a', 'b', 'c', 'd',
                ( byte ) 0xAA, 0x13,
                0x30, 0x11,
                ( byte ) 0xA0, 0x03,
                0x02, 0x01, 0x01,
                ( byte ) 0xA1, 0x0A,
                0x30, 0x08,
                0x1B, 0x06,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
        } );

        stream.flip();

        // Allocate a EncAsRepPart Container
        EncAsRepPartContainer encAsRepPartContainer = new EncAsRepPartContainer( stream );

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

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

        ByteBuffer stream = ByteBuffer.allocate( 0x02 );

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

        stream.flip();

        // Allocate a EncAsRepPart Container
        Asn1Container encAsRepPartContainer = new EncAsRepPartContainer( stream );

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

        super.transitions = new GrammarTransition[PasswordPolicyStates.END_STATE.ordinal()][256];

        // PasswordPolicyResponseValue ::= SEQUENCE {
        // ...
        super.transitions[PasswordPolicyStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
            PasswordPolicyStates.START_STATE, PasswordPolicyStates.PPOLICY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
            new PPolicyInit() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              warning [0] CHOICE {
        super.transitions[PasswordPolicyStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyTags.PPOLICY_WARNING_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_SEQ_STATE, PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE,
            PasswordPolicyTags.PPOLICY_WARNING_TAG.getValue(),
            new CheckNotNullLength() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              ...
        //              error   [1] ENUMERATED {
        super.transitions[PasswordPolicyStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyTags.PPOLICY_ERROR_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_SEQ_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
            PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(),
            new StoreError() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              warning [0] CHOICE {
        //                      timeBeforeExpiration [0] INTEGER (0 .. maxInt),
        super.transitions[PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyTags.TIME_BEFORE_EXPIRATION_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE,
            PasswordPolicyTags.TIME_BEFORE_EXPIRATION_TAG.getValue(),
            new StoreTimeBeforeExpiration() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              warning [0] CHOICE {
        //                      ...
        //                      graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL,
        super.transitions[PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE,
            PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
            new StoreGraceAuthsRemaining() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              ...
        //              error   [1] ENUMERATED {
        super.transitions[PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE.ordinal()][PasswordPolicyTags.PPOLICY_ERROR_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
            PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(),
            new StoreError() );

        // PasswordPolicyResponseValue ::= SEQUENCE {
        //              ...
        //              error   [1] ENUMERATED {
        super.transitions[PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE.ordinal()][PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG
            .getValue()] = new GrammarTransition(
            PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
            PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
            new StoreError() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.asn1.ber.grammar.GrammarTransition

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.