]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/manager/KeyUtils.java
bd093e797d793f010c335b642c80ed45d936dce3
1 package org
.asamk
.signal
.manager
;
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
;
13 static String
createSignalingKey() {
17 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 static String
createPassword() {
29 static byte[] createGroupId() {
30 return getSecretBytes(16);
33 static byte[] createUnrestrictedUnidentifiedAccess() {
34 return getSecretBytes(16);
37 static byte[] createStickerUploadKey() {
38 return getSecretBytes(64);
41 private static String
getSecret(int size
) {
42 byte[] secret
= getSecretBytes(size
);
43 return Base64
.encodeBytes(secret
);
46 private static byte[] getSecretBytes(int size
) {
47 byte[] secret
= new byte[size
];
48 RandomUtils
.getSecureRandom().nextBytes(secret
);