Package java.security

Examples of java.security.MessageDigest.reset()


            digest.update(COLON);
            digest.update(digestUri);

            return HexConverter.convertToHexBytes(digest.digest());
        } finally {
            digest.reset();
        }
    }

    private byte[] createHA2AuthInt() {
        // TODO - Implement method.
View Full Code Here


            digest.update(COLON);
            digest.update(ha2);

            return HexConverter.convertToHexBytes(digest.digest());
        } finally {
            digest.reset();
        }
    }

    private byte[] createRFC2617RequestDigest(final byte[] ha1, final byte[] ha2, final DigestContext context) {
        final MessageDigest digest = context.getDigest();
View Full Code Here

            digest.update(COLON);
            digest.update(ha2);

            return HexConverter.convertToHexBytes(digest.digest());
        } finally {
            digest.reset();
        }
    }

    @Override
    public ChallengeResult sendChallenge(final HttpServerExchange exchange, final SecurityContext securityContext) {
View Full Code Here

            digest.update(COLON);
            digest.update(digestUri);

            return HexConverter.convertToHexBytes(digest.digest());
        } finally {
            digest.reset();
        }
    }

    private static class DigestContext {
View Full Code Here

       
        byte[] hash=null;
        try
        {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.reset();
            md.update(nounce,0,16);
            hash = md.digest();
        }
        catch(Exception e)
        {
View Full Code Here

           
            byte[] hash=null;
            try
            {
                MessageDigest md = MessageDigest.getInstance("MD5");
                md.reset();
                md.update(n2,0,16);
                hash = md.digest();
            }
            catch(Exception e)
            {
View Full Code Here

                    md.update((byte)':');
                    md.update(password.getBytes(StringUtil.__ISO_8859_1));
                    ha1=md.digest();
                }
                // calc A2 digest
                md.reset();
                md.update(method.getBytes(StringUtil.__ISO_8859_1));
                md.update((byte)':');
                md.update(uri.getBytes(StringUtil.__ISO_8859_1));
                byte[] ha2=md.digest();
               
View Full Code Here

                }
                // 32-bit digest key=pass+salt
                ByteBuffer bbPass = ByteBuffer.allocate(32);
                MessageDigest md = MessageDigest.getInstance("MD5");
                bbPass.put(md.digest(stringToBytes(passPhrase)));
                md.reset();
                byte[] saltDigest = md.digest(salt);
                bbPass.put(saltDigest);
                boolean isCBC = algorithm.contains("/CBC/");
                SecretKey key = null;
                //CBC mode requires IvParameter with 8 byte input
View Full Code Here

            Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
        }

        // Reset the digest, in case it's been used already during this section of code
        // This probably isn't needed for pages of 210 simplicity
        alg.reset();

        // Calculate the md5 hash for the password. md5 operates on bytes, so give
        // MessageDigest the byte verison of the string
        alg.update(word.getBytes());
View Full Code Here

            md.update(realm.getBytes());
            md.update((byte)':');
            md.update(password.getBytes());
            byte[] ha1 = md.digest();
            // calc A2 digest
            md.reset();
            md.update(request.getMethod().getBytes());
            md.update((byte)':');
            md.update(uri.getBytes());
            byte[] ha2=md.digest();
           
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.