Merge pull request #1 from Pixeebot-2-0/pixeebot/drip-2024-11-16-pixee-java/secure-random
Introduced protections against predictable RNG abusepull/1694/head
commit
15813e872d
|
@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcMessage;
|
||||||
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
|
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
|
||||||
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
|
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
|
||||||
import com.genersoft.iot.vmp.service.redisMsg.control.RedisRpcController;
|
import com.genersoft.iot.vmp.service.redisMsg.control.RedisRpcController;
|
||||||
|
import java.security.SecureRandom;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
@ -31,7 +32,7 @@ public class RedisRpcConfig implements MessageListener {
|
||||||
|
|
||||||
public final static String REDIS_REQUEST_CHANNEL_KEY = "WVP_REDIS_REQUEST_CHANNEL_KEY";
|
public final static String REDIS_REQUEST_CHANNEL_KEY = "WVP_REDIS_REQUEST_CHANNEL_KEY";
|
||||||
|
|
||||||
private final Random random = new Random();
|
private final Random random = new SecureRandom();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSetting userSetting;
|
private UserSetting userSetting;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.auth;
|
package com.genersoft.iot.vmp.gb28181.auth;
|
||||||
|
|
||||||
import gov.nist.core.InternalErrorHandler;
|
import gov.nist.core.InternalErrorHandler;
|
||||||
|
import java.security.SecureRandom;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.sip.address.URI;
|
import javax.sip.address.URI;
|
||||||
|
@ -83,7 +84,7 @@ public class DigestServerAuthenticationHelper {
|
||||||
*/
|
*/
|
||||||
private String generateNonce() {
|
private String generateNonce() {
|
||||||
long time = Instant.now().toEpochMilli();
|
long time = Instant.now().toEpochMilli();
|
||||||
Random rand = new Random();
|
Random rand = new SecureRandom();
|
||||||
long pad = rand.nextLong();
|
long pad = rand.nextLong();
|
||||||
String nonceString = Long.valueOf(time).toString()
|
String nonceString = Long.valueOf(time).toString()
|
||||||
+ Long.valueOf(pad).toString();
|
+ Long.valueOf(pad).toString();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.jt1078.cmd;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.entity.Cmd;
|
import com.genersoft.iot.vmp.jt1078.proc.entity.Cmd;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
||||||
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ import java.util.Random;
|
||||||
*/
|
*/
|
||||||
public class JT1078Template {
|
public class JT1078Template {
|
||||||
|
|
||||||
private final Random random = new Random();
|
private final Random random = new SecureRandom();
|
||||||
|
|
||||||
private static final String H9101 = "9101";
|
private static final String H9101 = "9101";
|
||||||
private static final String H9102 = "9102";
|
private static final String H9102 = "9102";
|
||||||
|
|
Loading…
Reference in New Issue