Package org.apache.harmony.security.asn1

Examples of org.apache.harmony.security.asn1.ASN1BitString


                        new byte[] { 0x03, 0x03, 0x07, 0x00, (byte) 0x80 } } };

        ASN1NamedBitList encoder = new ASN1NamedBitList();

        for (int i = 0; i < testcaseBoolean.length; i++) {
            DerOutputStream out = new DerOutputStream(encoder,
                    testcaseBoolean[i][0]);
            assertTrue("Testcase: " + i, Arrays.equals(
                    (byte[]) testcaseBoolean[i][1], out.encoded));
        }
    }
View Full Code Here


    //FIXME need testcase for decoding invalid encodings

    public void testEncode() throws IOException {

        for (int i = 0; i < taggedType.length; i++) {
            DerOutputStream out = new DerOutputStream(
                    (ASN1Type) taggedType[i][2], taggedType[i][0]);
            assertTrue("Test case: " + i, Arrays.equals(
                    (byte[]) taggedType[i][1], out.encoded));
        }
    }
View Full Code Here

                            (byte[]) asn1.decode(in))); //returned
        }

        // encoding
        for (int i = 0; i < validTestcase.length; i++) {
            DerOutputStream out = new DerOutputStream(asn1, validTestcase[i][1]);
            assertTrue((validTestcase[i][0]).toString(), //message
                    Arrays.equals((byte[]) validTestcase[i][2], //expected
                            out.encoded));//returned
        }
    }
View Full Code Here

    //FIXME need testcase for decoding invalid encodings

    public void testEncode() throws IOException {

        for (int i = 0; i < testcases.length; i++) {
            DerOutputStream out = new DerOutputStream(choice, testcases[i][0]);
            assertTrue("Test case: " + i, Arrays.equals(
                    (byte[]) testcases[i][1], out.encoded));
        }
    }
View Full Code Here

                    utime.decode(in)); //decoded
        }

        // encoding date object
        for (int i = 0; i < validUTCTimes.length; i++) {
            DerOutputStream out = new DerOutputStream(utime,
                    validUTCTimes[i][2]);
            assertTrue("Encoding date for " + validUTCTimes[i][0], Arrays
                    .equals((byte[]) validUTCTimes[i][1], // expected
                            out.encoded)); //encoded
        }
View Full Code Here

                    gtime.decode(in)); //decoded
        }

        // encoding date object
        for (int i = 0; i < validGeneralizedTimes.length; i++) {
            DerOutputStream out = new DerOutputStream(gtime,
                    validGeneralizedTimes[i][2]);
            assertTrue("Encoding date for " + validGeneralizedTimes[i][0],
                    Arrays.equals((byte[]) validGeneralizedTimes[i][1], // expected
                            out.encoded)); //encoded
        }
View Full Code Here

        }
       
        // testing encoding
        for (int i = 0; i < oid.length; i++) {

            byte[] encoded = new DerOutputStream(ASN1Oid.getInstance(),
                    oid[i][1]).encoded;

            assertTrue("Failed to encode oid: " + oid[i][0], // error message
                    Arrays.equals((byte[]) oid[i][2], // expected encoding
                            encoded));
View Full Code Here

        // testing encoding
        for (int i = 0; i < oid.length; i++) {
            assertTrue("Failed to encode oid: " + oid[i][0], // error message
                    Arrays.equals((byte[]) oid[i][2], // expected encoding
                            new DerOutputStream(asn1, oid[i][0]).encoded));
        }
    }
View Full Code Here

        assertTrue(Arrays.equals(encoded, (byte[]) ASN1Any.getInstance()
                .decode(in)));
    }

    public void testEncode() throws IOException {
        DerOutputStream out = new DerOutputStream(ASN1Any.getInstance(),
                encoded);
        assertTrue("False", Arrays.equals(encoded, out.encoded));
    }
View Full Code Here

    //ASN.1 DER encoding
    private byte[] encoding;

    Oid(int[] data) {
        super();
        oid = new ObjectIdentifier(data);
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.asn1.ASN1BitString

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.