]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/manager/KeyUtils.java
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 private static String
getSecret(int size
) {
38 byte[] secret
= getSecretBytes(size
);
39 return Base64
.encodeBytes(secret
);
42 private static byte[] getSecretBytes(int size
) {
43 byte[] secret
= new byte[size
];
44 RandomUtils
.getSecureRandom().nextBytes(secret
);