Package com.maverick.crypto.digests

Examples of com.maverick.crypto.digests.Hash.doFinal()


            // H( unq(username-value) ":" unq(realm-value) ":" passwd )
            // ":" unq(nonce-value)
            // ":" unq(cnonce-value)

            hash.putBytes(a1.getBytes("US-ASCII")); //$NON-NLS-1$
            String tmp2 = encode(hash.doFinal());
            StringBuffer tmp3 = new StringBuffer(tmp2.length() + nonce.length() + cnonce.length() + 2);
            tmp3.append(tmp2);
            tmp3.append(':');
            tmp3.append(nonce);
            tmp3.append(':');
View Full Code Here


        }

        hash.reset();
        hash.putBytes(a1.getBytes("US-ASCII")); //$NON-NLS-1$
        String md5a1 = encode(hash.doFinal());

        String a2 = null;
        if (qopVariant == QOP_AUTH_INT) {
            // we do not have access to the entity-body or its hash
            // TODO: add Method ":" digest-uri-value ":" H(entity-body)
View Full Code Here

            a2 = method + ":" + uri; //$NON-NLS-1$
        }

        hash.reset();
        hash.putBytes(a2.getBytes("US-ASCII")); //$NON-NLS-1$
        String md5a2 = encode(hash.doFinal());

        // 3.2.2.1
        String serverDigestValue;
        if (qopVariant == QOP_MISSING) {
View Full Code Here

            serverDigestValue = tmp2.toString();
        }

        hash.reset();
        hash.putBytes(serverDigestValue.getBytes("US-ASCII")); //$NON-NLS-1$
        String serverDigest = encode(hash.doFinal());

        return serverDigest;
    }

    public static String createCnonce() {
View Full Code Here

        Hash hash = new Hash(new MD5Digest());

        cnonce = Long.toString(System.currentTimeMillis());

        hash.putBytes(cnonce.getBytes());
        cnonce = encode(hash.doFinal());

        return cnonce;
    }

    private static String encode(byte[] binaryData) {
View Full Code Here

    private byte[] makePassphraseKey(String passphrase) {
            // Generate the key using the passphrase
            Hash md5 = new Hash("MD5");
            md5.putBytes(passphrase.getBytes());

            byte[] key1 = md5.doFinal();
            md5.reset();
            md5.putBytes(passphrase.getBytes());
            md5.putBytes(key1);

            byte[] key2 = md5.doFinal();
View Full Code Here

            byte[] key1 = md5.doFinal();
            md5.reset();
            md5.putBytes(passphrase.getBytes());
            md5.putBytes(key1);

            byte[] key2 = md5.doFinal();
            byte[] key = new byte[32];
            System.arraycopy(key1, 0, key, 0, 16);
            System.arraycopy(key2, 0, key, 16, 16);

            return key;
View Full Code Here

     */
    public String getFingerprint() {
            Hash md5 = new Hash("MD5");
            md5.putBytes(getEncoded());

            byte[] digest = md5.doFinal();
            int bits = getBitLength();
            bits = (((bits % 8) != 0) ? (bits += (bits % 8)) : bits);

            String ret = String.valueOf(bits);

View Full Code Here

            hash.putString(session.getId());
        }
        hash.putInt(id);
        hash.putString(user.getPrincipalName());
        hash.putString(address.getHostAddress());
        byte[] tmp = hash.doFinal();
        uid = Util.toHexString(tmp);
       
        CoreServlet.getServlet().addCoreListener(this);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.