X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/701328b8c26d6ad4f98cf8213dd57e4b06aa1281..35c72f692f13b12594ecdbe8f59f31d3b396d356:/src/main/java/org/asamk/signal/util/KeyUtils.java diff --git a/src/main/java/org/asamk/signal/util/KeyUtils.java b/src/main/java/org/asamk/signal/util/KeyUtils.java deleted file mode 100644 index ab421384..00000000 --- a/src/main/java/org/asamk/signal/util/KeyUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.asamk.signal.util; - -import org.whispersystems.signalservice.internal.util.Base64; - -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; - -public class KeyUtils { - - private KeyUtils() { - } - - public static String createSignalingKey() { - return getSecret(52); - } - - public static byte[] createProfileKey() { - return getSecretBytes(32); - } - - public static String createPassword() { - return getSecret(18); - } - - public static byte[] createGroupId() { - return getSecretBytes(16); - } - - private static String getSecret(int size) { - byte[] secret = getSecretBytes(size); - return Base64.encodeBytes(secret); - } - - private static byte[] getSecretBytes(int size) { - byte[] secret = new byte[size]; - getSecureRandom().nextBytes(secret); - return secret; - } - - private static SecureRandom getSecureRandom() { - try { - return SecureRandom.getInstance("SHA1PRNG"); - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } - } -}