From 17ac41c8cb1b10cff70a33b0d1701817f2aae544 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 12 Mar 2021 22:21:22 +0100 Subject: [PATCH] [core] Add RandomUtil.fillWithSecureRandom(byte[]) --- .../main/java/org/jivesoftware/smack/util/RandomUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/RandomUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/RandomUtil.java index 857557869..88c71e7aa 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/RandomUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/RandomUtil.java @@ -1,6 +1,6 @@ /** * - * Copyright 2003-2007 Jive Software, 2016-2019 Florian Schmaus. + * Copyright 2003-2007 Jive Software, 2016-2021 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,4 +47,8 @@ public class RandomUtil { public static int nextSecureRandomInt() { return SECURE_RANDOM.get().nextInt(); } + + public static void fillWithSecureRandom(byte[] bytes) { + SECURE_RANDOM.get().nextBytes(bytes); + } }