Package sun.misc

Examples of sun.misc.HexDumpEncoder


    /*
     * Output the packet info.
     */
    private void dumpPacket(EngineArgs ea, boolean hsData) {
        try {
            HexDumpEncoder hd = new HexDumpEncoder();

            ByteBuffer bb = ea.netData.duplicate();

            int pos = bb.position();
            bb.position(pos - ea.deltaNet());
            bb.limit(pos);

            System.out.println("[Raw write" +
                (hsData ? "" : " (bb)") + "]: length = " +
                bb.remaining());
            hd.encodeBuffer(bb, System.out);
        } catch (IOException e) { }
    }
View Full Code Here


    static void traceOutput(String traceTag, byte[] output, int offset,
        int len) {
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream(len);
            new HexDumpEncoder().encodeBuffer(
                new ByteArrayInputStream(output, offset, len), out);

            System.err.println(traceTag + ":" + out.toString());
        } catch (Exception e) {
        }
View Full Code Here

     * Need a helper function so we can hash the V2 hello correctly
     */
    private void hashInternal(byte buf [], int offset, int len) {
        if (debug != null && Debug.isOn("data")) {
            try {
                HexDumpEncoder hd = new HexDumpEncoder();

                System.out.println("[write] MD5 and SHA1 hashes:  len = "
                    + len);
                hd.encodeBuffer(new ByteArrayInputStream(buf,
                    lastHashed, len), System.out);
            } catch (IOException e) { }
        }

        handshakeHash.update(buf, lastHashed, len);
View Full Code Here

        s.flush();

        // Output only the record from the specified debug offset.
        if (debug != null && Debug.isOn("packet")) {
            try {
                HexDumpEncoder hd = new HexDumpEncoder();
                ByteBuffer bb = ByteBuffer.wrap(
                        buf, off + debugOffset, len - debugOffset);

                System.out.println("[Raw write]: length = " +
                    bb.remaining());
                hd.encodeBuffer(bb, System.out);
            } catch (IOException e) { }
        }
    }
View Full Code Here

        TlsMasterSecretParameterSpec spec = new TlsMasterSecretParameterSpec
                (preMasterSecret, protocolVersion.major, protocolVersion.minor,
                clnt_random.random_bytes, svr_random.random_bytes);

        if (debug != null && Debug.isOn("keygen")) {
            HexDumpEncoder      dump = new HexDumpEncoder();

            System.out.println("SESSION KEYGEN:");

            System.out.println("PreMaster Secret:");
            printHex(dump, preMasterSecret.getEncoded());
View Full Code Here

        //
        // Dump the connection keys as they're generated.
        //
        if (debug != null && Debug.isOn("keygen")) {
            synchronized (System.out) {
                HexDumpEncoder  dump = new HexDumpEncoder();

                System.out.println("CONNECTION KEYGEN:");

                // Inputs:
                System.out.println("Client Nonce:");
View Full Code Here

    /*
     * Returns a printable representation of the key
     */
    public String toString ()
    {
        HexDumpEncoder  encoder = new HexDumpEncoder ();

        return "algorithm = " + algid.toString ()
            + ", unparsed keybits = \n" + encoder.encodeBuffer (key);
    }
View Full Code Here

        // encode, getEncoded()
        DerOutputStream dos = new DerOutputStream();
        subject.encode(dos);
        byte[] out = dos.toByteArray();
        byte[] enc = subject.getEncoded();
        HexDumpEncoder e = new HexDumpEncoder();
        if (Arrays.equals(out, enc))
            System.out.println("Sucess: out:" + e.encodeBuffer(out));
        else {
            System.out.println("Failed: encode:" + e.encodeBuffer(out));
            System.out.println("getEncoded:" + e.encodeBuffer(enc));
        }
        X500Name x = new X500Name(enc);
        if (x.equals(subject))
            System.out.println("Sucess: X500Name(byte[]):" + x.toString());
        else
View Full Code Here

                sb.append("    type " + list.get(0) +
                          ", name " + list.get(1) + "\n");
            }
        }
        if (subjectKeyID != null) {
            HexDumpEncoder enc = new HexDumpEncoder();
            sb.append("  Subject Key Identifier: " +
                      enc.encodeBuffer(subjectKeyID) + "\n");
        }
        if (authorityKeyID != null) {
            HexDumpEncoder enc = new HexDumpEncoder();
            sb.append("  Authority Key Identifier: " +
                      enc.encodeBuffer(authorityKeyID) + "\n");
        }
        if (certificateValid != null) {
            sb.append("  Certificate Valid: " +
                      certificateValid.toString() + "\n");
        }
View Full Code Here

            System.out.println("NIGHTLY:  Should *NOT* be here!!!\n" +
                "aliceLen = " + aliceLen + "\n" +
                "Alice's shared secret");

            try {
                HexDumpEncoder hd = new HexDumpEncoder();

                hd.encodeBuffer(
                    new ByteArrayInputStream(aliceSharedSecret), System.out);
            } catch (IOException e) { }

            System.out.println("bobLen = " + bobLen);

            try {
                HexDumpEncoder hd = new HexDumpEncoder();

                hd.encodeBuffer(
                    new ByteArrayInputStream(bobSharedSecret), System.out);
            } catch (IOException e) { }

            throw new Exception("Shouldn't be succeeding.");
        } catch (ShortBufferException e) {
View Full Code Here

TOP

Related Classes of sun.misc.HexDumpEncoder

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.