我正在为Android中的PBE实现和AES加密引擎,我发现了两种方法来实现IV的创建,我想知道哪一个更好,更安全得到IvParameterSpec:
方法#1:
SecureRandom randomSecureRandom = SecureRandom.getInstance("SHA1PRNG");
byte[] iv = new byte[cipher.getBlockSize()];
randomSecureRandom.nextBytes(iv);
IvParameterSpec ivParams = new IvParameterSpec(iv);
Run Code Online (Sandbox Code Playgroud)
方法#2:
AlgorithmParameters params = cipher.getParameters();
byte[] iv2 = params.getParameterSpec(IvParameterSpec.class).getIV();
ivParams = new IvParameterSpec(iv2);
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下方法查找网络中的所有服务:
mNsdManager.discoverServices(
SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, mDiscoveryListener);
Run Code Online (Sandbox Code Playgroud)
但您必须定义SERVICE_TYPE,例如:
public static final String SERVICE_TYPE = "_http._tcp.";
Run Code Online (Sandbox Code Playgroud)
因此它将使用tcp发现所有http服务,但它不会同时找到https服务或任何其他类型的服务
如何设置所有这些以便使用tcp查找任何服务?
先感谢您.