Package org.cfcc

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


        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

Related Classes of org.cfcc.SystemUnavailableException

Copyright © 2018 www.massapicom. 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.