Package java.security

Examples of java.security.MessageDigest.reset()


        Arrays.fill(buff, (byte) 0x5c);
        for (int i=0; i<finalHash.length; i++) {
            buff[i] = (byte) (buff[i] ^ finalHash[i]);
        }

        sha1.reset();
        byte[] x2 = sha1.digest(buff);

        byte[] x3 = new byte[x1.length + x2.length];
        System.arraycopy(x1, 0, x3, 0, x1.length);
        System.arraycopy(x2, 0, x3, x1.length, x2.length);
View Full Code Here


        sha1.update(info.getVerifier().getSalt());
        byte[] hash = sha1.digest(bytes);
        byte[] iterator = new byte[4];

        for (int i = 0; i < info.getVerifier().getSpinCount(); i++) {
            sha1.reset();
            LittleEndian.putInt(iterator, i);
            sha1.update(iterator);
            hash = sha1.digest(hash);
        }
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

            offset += b2.length;

            System.arraycopy(b3, 0, b4, offset, b3.length);

            MessageDigest sha = MessageDigest.getInstance("SHA-1");
            sha.reset();
            sha.update(b4);
            return new String(Base64.encodeBase64(sha.digest()));
        } catch (NoSuchAlgorithmException e) {
            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "decoding.general", e);
        } catch (UnsupportedEncodingException e) {
View Full Code Here

                sha1Helper = MessageDigest.getInstance("SHA1");
            } catch (NoSuchAlgorithmException e) {
                throw new ServletException(e);
            }
        }
        sha1Helper.reset();
        sha1Helper.update(key.getBytes(StandardCharsets.ISO_8859_1));
        String result = Base64.encodeBase64String(sha1Helper.digest(WS_ACCEPT));
        sha1Helpers.add(sha1Helper);
        return result;
    }
View Full Code Here

        try {
            sha = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e1) {
            throw new RampartException("noSHA1availabe", e1);
        }
        sha.reset();
        sha.update(input);
        byte[] data = sha.digest();
       
        return Base64.encode(data);
    }
View Full Code Here

      * @throws NoSuchAlgorithmException If the algorithm doesn't exist
   * @throws UnsupportedEncodingException
      */
     public byte[] getHash(int iterationNb, String password, byte[] salt) throws NoSuchAlgorithmException, UnsupportedEncodingException {
         MessageDigest digest = MessageDigest.getInstance("SHA-1");
         digest.reset();
         digest.update(salt);
         byte[] input = digest.digest(password.getBytes("UTF-8"));
         for (int i = 0; i < iterationNb; i++) {
             digest.reset();
             input = digest.digest(input);
View Full Code Here

         MessageDigest digest = MessageDigest.getInstance("SHA-1");
         digest.reset();
         digest.update(salt);
         byte[] input = digest.digest(password.getBytes("UTF-8"));
         for (int i = 0; i < iterationNb; i++) {
             digest.reset();
             input = digest.digest(input);
         }
         return input;
     }
  
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.