1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-26 06:07:59 +01:00

[omemo] Use RandomUtil.fillWithSecureRandom() to generate IV

This commit is contained in:
Florian Schmaus 2021-03-12 22:21:58 +01:00
parent 17ac41c8cb
commit b7905d585d

View file

@ -36,6 +36,7 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.jivesoftware.smack.util.RandomUtil;
import org.jivesoftware.smackx.omemo.OmemoRatchet;
import org.jivesoftware.smackx.omemo.OmemoService;
import org.jivesoftware.smackx.omemo.element.OmemoElement;
@ -278,9 +279,8 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @return initialization vector
*/
public static byte[] generateIv() {
SecureRandom random = new SecureRandom();
byte[] iv = new byte[12];
random.nextBytes(iv);
RandomUtil.fillWithSecureRandom(iv);
return iv;
}
}