Package org.apache.harmony.security.asn1

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


     * @param encoding - ASN.1 DER encoding
     * @throws IOException - if encoding is wrong
     */
    public Name(byte[] encoding) throws IOException {

        DerInputStream in = new DerInputStream(encoding);

        if (in.getEndOffset() != encoding.length) {
            throw new IOException(Messages.getString("security.111")); //$NON-NLS-1$
        }

        ASN1.decode(in);

View Full Code Here


     * @param encoding - ASN.1 DER encoding
     * @throws IOException - if encoding is wrong
     */
    public Name(byte[] encoding) throws IOException {

        DerInputStream in = new DerInputStream(encoding);

        if (in.getEndOffset() != encoding.length) {
            throw new IOException(Messages.getString("security.111")); //$NON-NLS-1$
        }

        ASN1.decode(in);

View Full Code Here

        this.hexString = hexString;
        this.encoded = encoded;

        try {
            DerInputStream in = new DerInputStream(encoded);

            tag = in.tag;

            if (DirectoryString.ASN1.checkTag(tag)) {
                // has string representation
View Full Code Here

                socket.receive(resp);

                bytesRead = resp.getLength();
                out.write(buf, resp.getOffset(), bytesRead);
            }
            DerInputStream in = new DerInputStream(out.toByteArray());

            if (in.tag == KDCReply.AS_REP_ASN1.constrId) { //TODO AS reply
                KDCReply reply = (KDCReply) KDCReply.AS_REP_ASN1.decode(in);

                KerberosKey key = new KerberosKey(new KerberosPrincipal(cname
View Full Code Here

public class KerberosErrorMessageTest extends TestCase {

    public void test_Ctor() throws IOException {

        KerberosErrorMessage message = KerberosErrorMessage
                .decode(new DerInputStream(err_resp));

        assertEquals("ctime", new Date(1000), message.getCtime());
        assertEquals("cusec", 65536, message.getCusec());

        assertEquals("stime", new Date(0), message.getStime());
View Full Code Here

     * @param encoding - ASN.1 DER encoding
     * @throws IOException - if encoding is wrong
     */
    public Name(byte[] encoding) throws IOException {

        DerInputStream in = new DerInputStream(encoding);

        if (in.getEndOffset() != encoding.length) {
            throw new IOException(Messages.getString("security.111")); //$NON-NLS-1$
        }

        ASN1.decode(in);

View Full Code Here

        this.hexString = hexString;
        this.encoded = encoded;

        try {
            DerInputStream in = new DerInputStream(encoded);

            tag = in.tag;

            if (DirectoryString.ASN1.checkTag(tag)) {
                // has string representation
View Full Code Here

    };

    public void testDecode_Valid() throws IOException {

        for (int i = 0; i < testcases.length; i++) {
            DerInputStream in = new DerInputStream((byte[]) testcases[i][1]);
            assertEquals("Test case: " + i, testcases[i][0], choice.decode(in));
        }
    }
View Full Code Here

                    new ASN1Implicit(ASN1Constants.CLASS_PRIVATE, 5, sequence) } };

    public void testDecode_Valid() throws IOException {

        for (int i = 0; i < taggedType.length; i++) {
            DerInputStream in = new DerInputStream((byte[]) taggedType[i][1]);
            assertEquals("Test case: " + i, taggedType[i][0],
                    ((ASN1Type) taggedType[i][2]).decode(in));
        }
    }
View Full Code Here

    public void testDecode_Valid() throws IOException {

        for (int i = 0; i < testcases.length; i++) {
            try {
                DerInputStream in = new DerInputStream((byte[]) testcases[i][1]);
                assertEquals("Test case: " + i, testcases[i][0], sequence
                        .decode(in));
            } catch (ASN1Exception e) {
                fail("Test case: " + i + "\n" + e.getMessage());
            }
View Full Code Here

TOP

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

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.