-
Notifications
You must be signed in to change notification settings - Fork 1
Seam 3 to DeltaSpike Migration Notes
codylerum edited this page Mar 30, 2013
·
1 revision
-
Seam Config declarations will cause deployment errors with deltaspike-security and possibly others due to Seam Config firing a ProcessAnnotatedType event before BeforeBeanDiscovery
-
Password Hasing from Seam Security can be accomplished via built in Java 6 SE security utils
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import com.google.common.io.BaseEncoding;
public class PasswordHash {
public static String createPasswordKey(String password, byte[] salt, int iterations) throws NoSuchAlgorithmException, InvalidKeySpecException {
String algorithm = "PBKDF2WithHmacSHA1";
int keyLength = 160;
KeySpec spec = new PBEKeySpec(password.toCharArray(), salt, iterations, keyLength);
SecretKeyFactory f = SecretKeyFactory.getInstance(algorithm);
return BaseEncoding.base16().encode(f.generateSecret(spec).getEncoded());
}
}