Package com.sun.satsa.util

Examples of com.sun.satsa.util.TLV


     * Tests DER encoding of DomainComponent.
     */
    private void testOne() {
        String nameInfo =
            "cn=Certificate, dc=www, Dc=sun, dC=com";
        TLV name;
        boolean ok = true;

        try {
            name = new TLV(RFC2253Name.toDER(nameInfo), 0);
        } catch (TLVException e) {
            name = null;
            ok = false;
        }
        assertTrue("Invalid name", ok);
        assertTrue("Bad DER result", name != null &&
                    equal(name.getDERData(), testOneResult));
    }
View Full Code Here


    }
   
    private void testTwo() {
        String nameInfo =
            "cn=Certificate1, dc=";
        TLV name;
        boolean ok = true;

        try {
            name = new TLV(RFC2253Name.toDER(nameInfo), 0);
        } catch (TLVException e) {
            name = null;
            ok = false;
        }
        assertTrue("Invalid name", ok);
        assertTrue("Bad DER result", name != null &&
                    equal(name.getDERData(), testTwoResult));
    }
View Full Code Here

    }
   
    private void testThree() {
        String nameInfo =
         "cn=Certificate, OID.0.9.2342.19200300.100.1.25=www, dc=sun, dc=com";
        TLV name;
        boolean ok = true;

        try {
            name = new TLV(RFC2253Name.toDER(nameInfo), 0);
        } catch (TLVException e) {
            name = null;
            ok = false;
        }
        assertTrue("Invalid name", ok);
        assertTrue("Bad DER result", name != null &&
                    equal(name.getDERData(), testOneResult));
    }
View Full Code Here

         }
         *
         */

        try {
            TLV t = new TLV(data, 0);

            t = t.child;    // AlgorithmIdentifier
            if (! Utils.byteMatch(data, t.child.valueOffset, t.child.length,
                                 RSA_OID, 0, RSA_OID.length)) {
                throw new InvalidKeySpecException(
                        "Invalid algorithm identifier");
            }

            t = t.next;     // subjectPublicKey

            /*
             *  RSAPublicKey ::= SEQUENCE {
             *      modulus            INTEGER, -- n
             *      publicExponent     INTEGER  -- e --
             *  }
             */

            // the first byte of value in BIT STRING is the number of
            // unused bits
            t = new TLV(data, t.valueOffset + 1);

            t = t.child;    // modulus

            int offset = t.valueOffset;
            int len = t.length;
View Full Code Here

TOP

Related Classes of com.sun.satsa.util.TLV

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.