Package org.apache.harmony.security.asn1

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


    //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

    }

    public Oid(byte[] data) throws GSSException {
        super();
        try {
            oid = new ObjectIdentifier((int[]) ASN1.decode(data));
        } catch (IOException e) {
            GSSException gsse = new GSSException(GSSException.FAILURE);
            gsse.initCause(e);
            throw gsse;
        }
View Full Code Here

        if (derOid == null) {
            throw new NullPointerException();
        }

        try {
            oid = new ObjectIdentifier((int[]) ASN1.decode(derOid));
        } catch (IOException e) {
            GSSException gsse = new GSSException(GSSException.FAILURE);
            gsse.initCause(e);
            throw gsse;
        }
View Full Code Here

    }

    public Oid(String strOid) throws GSSException {
        super();
        try {
            oid = new ObjectIdentifier(strOid);
        } catch (IllegalArgumentException e) {
            GSSException gsse = new GSSException(GSSException.FAILURE);
            gsse.initCause(e);
            throw gsse;
        }
View Full Code Here

TOP

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

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.