ARTEMIS-786 Using RandomUtil instead of SecureRandom..

This was introducing several performance hits. I was running the examples and they were not completing at all on my environment.
This commit is contained in:
Clebert Suconic 2016-11-02 18:09:25 -04:00
parent e89f6a1bfd
commit 5965a45894

View File

@ -22,7 +22,6 @@ import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -189,10 +188,7 @@ public class DefaultSensitiveStringCodec implements SensitiveDataCodec<String> {
} }
public byte[] getSalt() throws NoSuchAlgorithmException { public byte[] getSalt() throws NoSuchAlgorithmException {
byte[] salt = new byte[this.saltLength]; byte[] salt = RandomUtil.randomBytes(this.saltLength);
SecureRandom sr = SecureRandom.getInstance(this.randomScheme);
sr.nextBytes(salt);
return salt; return salt;
} }