Package org.apache.harmony.security.asn1

Examples of org.apache.harmony.security.asn1.ASN1Boolean.decode()


        // oid decoder/encoder for testing
        ASN1Boolean asn1 = ASN1Boolean.getInstance();

        // decoding false
        DerInputStream in = new DerInputStream(eFalse);
        assertEquals("Decoding false value", Boolean.FALSE, asn1.decode(in));

        // decoding true
        in = new DerInputStream(eTrue);
        assertEquals("Decoding true value", Boolean.TRUE, asn1.decode(in));
View Full Code Here


        DerInputStream in = new DerInputStream(eFalse);
        assertEquals("Decoding false value", Boolean.FALSE, asn1.decode(in));

        // decoding true
        in = new DerInputStream(eTrue);
        assertEquals("Decoding true value", Boolean.TRUE, asn1.decode(in));

        // encoding false
        DerOutputStream out = new DerOutputStream(asn1, Boolean.FALSE);
        assertTrue("Encoding false value", Arrays.equals(eFalse, out.encoded));
View Full Code Here

            public int getIndex(Object obj) {
                return 0;
            }
        };

        Boolean b = (Boolean) choice2.decode(new byte[] { 0x01, 0x01, 0x00 });

        assertTrue(b == Boolean.FALSE);
    }

    /**
 
View Full Code Here

            public int getIndex(Object obj) {
                return 0;
            }
        };

        Boolean b = (Boolean) choice2.decode(new byte[] { 0x01, 0x01, 0x00 });

        assertTrue(b == Boolean.FALSE);
    }

    /**
 
View Full Code Here

        ASN1Explicit explicit = new ASN1Explicit(0, choice);

        byte[] encoded = new byte[] { (byte) 0xA0, 0x03, 0x01, 0x01, 0x00 };

        assertEquals("False: ", Boolean.FALSE, explicit.decode(encoded));

        encoded[4] = (byte) 0xFF;

        assertEquals("True: ", Boolean.TRUE, explicit.decode(encoded));
    }
View Full Code Here

        assertEquals("False: ", Boolean.FALSE, explicit.decode(encoded));

        encoded[4] = (byte) 0xFF;

        assertEquals("True: ", Boolean.TRUE, explicit.decode(encoded));
    }
   
    /**
     * TODO Put method description here
     */
 
View Full Code Here

        ASN1Explicit explicit = new ASN1Explicit(0, choice);

        byte[] encoded = new byte[] { (byte) 0xA0, 0x03, 0x01, 0x01, 0x00 };

        assertEquals("False: ", Boolean.FALSE, explicit.decode(encoded));

        encoded[4] = (byte) 0xFF;

        assertEquals("True: ", Boolean.TRUE, explicit.decode(encoded));
    }
View Full Code Here

        assertEquals("False: ", Boolean.FALSE, explicit.decode(encoded));

        encoded[4] = (byte) 0xFF;

        assertEquals("True: ", Boolean.TRUE, explicit.decode(encoded));
    }
   
    /**
     * TODO Put method description here
     */
 
View Full Code Here

                0x00 };

        byte[] array = new byte[] { 0x00, 0x01, 0x02 };

        // decode primitive
        assertTrue(Arrays.equals(array, (byte[]) type2
                .decode(primitiveEncoding)));

        // encode primitive
        assertTrue(Arrays.equals(primitiveEncoding, type2.encode(array)));
View Full Code Here

        // encode primitive
        assertTrue(Arrays.equals(primitiveEncoding, type2.encode(array)));

        // decode constructed
        try {
            type2.decode(constructedEncoding);
            fail("No expected ASN1Exception");
        } catch (ASN1Exception e) {
            // FIXME any other check instead of comparing the message???
            assertEquals(
                    "ASN.1 octetstring: constructed identifier at [0]. Not valid for DER.",
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.