Examples of SystemUnavailableException


Examples of org.apache.wookie.exceptions.SystemUnavailableException

    MessageDigest md = null;
    try {
      md = MessageDigest.getInstance(_algorithm);
    }
    catch (NoSuchAlgorithmException e) {
      throw new SystemUnavailableException(e.getMessage());
    }
    try {
      md.update(plaintext.getBytes("UTF-8"));
    }
    catch (UnsupportedEncodingException e) {
      throw new SystemUnavailableException(e.getMessage());
    }

    byte raw[] = md.digest(); //step 4
    String hash = new String((new Base64()).encode(raw));
    return hash; //step 6
View Full Code Here

Examples of org.cfcc.SystemUnavailableException

        MessageDigest sha;
       
        try {
            sha = MessageDigest.getInstance("SHA");
        } catch (java.security.NoSuchAlgorithmException e) {
            throw new SystemUnavailableException("No SHA implementation available!", e);
        }
       
        sha.update(rawPass.getBytes());
       
        if (salt != null) {
            if (salt.getClass().isInstance(Byte.class)) {
                throw new SystemUnavailableException("Salt value must be a byte array");
            }
            sha.update((byte[]) salt);
        }
       
        byte[] hash = combineHashAndSalt(sha.digest(), (byte[]) salt);
View Full Code Here

Examples of org.cfcc.SystemUnavailableException

        byte[] salt = createRandomSalt();

        try {
            md = MessageDigest.getInstance("SHA"); //step 2
        } catch (NoSuchAlgorithmException e) {
            throw new SystemUnavailableException(e.getMessage());
        }
        try {
            md.update(salt);
            md.update(plaintext.getBytes("UTF-8")); //step 3
        } catch (UnsupportedEncodingException e) {
            throw new SystemUnavailableException(e.getMessage());
        }
        byte[] raw = md.digest(); //step 4
        String hash = "{SSHA}" + (new String(Base64.encodeBase64(concatenate(raw, salt)))); //step 5
        return hash; //step 6
    }
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.