]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/manager/util/KeyUtils.java
1 package org
.asamk
.signal
.manager
.util
;
3 import org
.asamk
.signal
.util
.RandomUtils
;
4 import org
.signal
.zkgroup
.InvalidInputException
;
5 import org
.signal
.zkgroup
.profiles
.ProfileKey
;
6 import org
.whispersystems
.util
.Base64
;
8 public class KeyUtils
{
13 public static String
createSignalingKey() {
17 public static ProfileKey
createProfileKey() {
19 return new ProfileKey(getSecretBytes(32));
20 } catch (InvalidInputException e
) {
21 throw new AssertionError("Profile key is guaranteed to be 32 bytes here");
25 public static String
createPassword() {
29 public static byte[] createStickerUploadKey() {
30 return getSecretBytes(32);
33 private static String
getSecret(int size
) {
34 byte[] secret
= getSecretBytes(size
);
35 return Base64
.encodeBytes(secret
);
38 public static byte[] getSecretBytes(int size
) {
39 byte[] secret
= new byte[size
];
40 RandomUtils
.getSecureRandom().nextBytes(secret
);