Use SecureRandom instead of Random
This commit is contained in:
parent
f2be09a789
commit
87eea27c1d
2 changed files with 4 additions and 4 deletions
src/main/java/org/mrpdaemon/sec/encfs
|
@ -15,7 +15,7 @@
|
|||
|
||||
package org.mrpdaemon.sec.encfs;
|
||||
|
||||
import java.util.Random;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* Class representing volume configuration data for an EncFS volume.
|
||||
|
@ -107,7 +107,7 @@ public class EncFSConfig {
|
|||
*/
|
||||
public static void encodeVolumeKey(EncFSConfig config, String password, byte[] volKey)
|
||||
throws EncFSInvalidConfigException, EncFSUnsupportedException, EncFSCorruptDataException {
|
||||
Random random = new Random();
|
||||
SecureRandom random = new SecureRandom();
|
||||
config.setSaltLength(20);
|
||||
|
||||
// Generate random salt
|
||||
|
|
|
@ -22,10 +22,10 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.Mac;
|
||||
|
@ -339,7 +339,7 @@ public class EncFSVolume {
|
|||
*/
|
||||
public static EncFSVolume createVolume(EncFSFileProvider fileProvider, EncFSConfig config, String password)
|
||||
throws EncFSInvalidPasswordException, EncFSInvalidConfigException, EncFSCorruptDataException, EncFSUnsupportedException, IOException {
|
||||
Random random = new Random();
|
||||
SecureRandom random = new SecureRandom();
|
||||
|
||||
// Create a random volume key + IV pair
|
||||
byte[] randVolKey = new byte[config.getVolumeKeySize() / 8 +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue