Package java.security

Examples of java.security.MessageDigest.reset()


            alg = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException ex) {
            // this should never happen
            throw new MathInternalError(ex);
        }
        alg.reset();

        // Compute number of iterations required (40 bytes each)
        int numIter = (len / 40) + 1;

        StringBuilder outBuffer = new StringBuilder();
View Full Code Here


        InputStream stream = null;
        try {
            stream = new FileInputStream(file);
           
            MessageDigest digester = MessageDigest.getInstance(algorithm);
            digester.reset();

            byte buf[] = new byte[4096];
            int len = 0;

            while ((len = stream.read(buf, 0, 1024)) != -1) {
View Full Code Here

    private static byte[] compute(File f, String algorithm) throws IOException {
        InputStream is = new FileInputStream(f);

        try {
            MessageDigest md = getMessageDigest(algorithm);
            md.reset();

            byte[] buf = new byte[BUFFER_SIZE];
            int len = 0;
            while ((len = is.read(buf)) != -1) {
                md.update(buf, 0, len);
View Full Code Here

    // This is a standard name: check,
    // http://java.sun.com/products/jdk/1.{1,2}
    //          /docs/guide/security/CryptoSpec.html#AppA
    try {
      MessageDigest digestAlgorithm = MessageDigest.getInstance("SHA-1");
      digestAlgorithm.reset();

    } catch (NoSuchAlgorithmException nsae) {
      throw Monitor.exceptionStartingModule(nsae);
    }
View Full Code Here

    } catch (NoSuchAlgorithmException nsae)
    {
          // Ignore as we checked already during service boot-up
    }

    algorithm.reset();
    byte[] bytePasswd = null;
        bytePasswd = StringUtil.toHexByte(
                plainTxtUserPassword,0,plainTxtUserPassword.length());
    algorithm.update(bytePasswd);
    byte[] encryptVal = algorithm.digest();
View Full Code Here

        // side - Hence, we have to generate a password substitute.
        // In other words, we cannot figure what the original password was -
        // Strong Password Substitution (USRSSBPWD) cannot be supported for
        // targets which can't access or decrypt passwords on their side.
        //
        messageDigest.reset();

        byte[] bytePasswd = null;
        byte[] userBytes = StringUtil.toHexByte(userName, 0, userName.length());

        if (SanityManager.DEBUG)
View Full Code Here

                    cert = certs[0];
                }
                if (!(cert instanceof X509Certificate)) {
                    continue;
                }
                sha.reset();
                try {
                    sha.update(cert.getEncoded());
                } catch (CertificateEncodingException e1) {
                    throw new WSSecurityException(
                            WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
View Full Code Here

                throw new WSSecurityException(
                        1,
                        "noSKIHandling",
                        new Object[]{"Wrong certificate version (<3) and no SHA1 message digest availabe"});
            }
            sha.reset();
            sha.update(value);
            return sha.digest();
        }

        /**
 
View Full Code Here

            offset += b2.length;

            System.arraycopy(b3, 0, b4, offset, b3.length);
           
            MessageDigest sha = MessageDigest.getInstance("SHA-1");
            sha.reset();
            sha.update(b4);
            passwdDigest = Base64.encode(sha.digest());
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

        try {
            sha = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            throw new WSSecurityException(0, "noSHA1availabe");
        }
        sha.reset();

        /*
         * Make the first hash round with start value
         */
        byte[] K = sha.digest(pwSalt);
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.