Use SecureRandom instead of Random (#15459)

Make sure that SecureRadom is used whenever the random number
is used for cryptographic operations, e.g. as nonce/salt.

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-08-20 21:29:37 +02:00
committed by GitHub
parent e86998000e
commit 95ac2eb80b
7 changed files with 14 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
@@ -45,7 +46,7 @@ import org.slf4j.Logger;
@NonNullByDefault
public class CloudUtil {
private static final Random RANDOM = new Random();
private static final Random RANDOM = new SecureRandom();
/**
* Saves the Xiaomi cloud device info with tokens to file