mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Move IdentityKeyPair generation to KeyUtils
in preparation for rust libsignal which doesn't provide the method
This commit is contained in:
parent
00339b1abe
commit
88d81c7a63
3 changed files with 15 additions and 2 deletions
|
@ -317,7 +317,7 @@ public class Manager implements Closeable {
|
|||
PathConfig pathConfig = PathConfig.createDefault(settingsPath);
|
||||
|
||||
if (!SignalAccount.userExists(pathConfig.getDataPath(), username)) {
|
||||
IdentityKeyPair identityKey = KeyHelper.generateIdentityKeyPair();
|
||||
IdentityKeyPair identityKey = KeyUtils.generateIdentityKeyPair();
|
||||
int registrationId = KeyHelper.generateRegistrationId(false);
|
||||
|
||||
ProfileKey profileKey = KeyUtils.createProfileKey();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ProvisioningManager {
|
|||
this.serviceConfiguration = serviceConfiguration;
|
||||
this.userAgent = userAgent;
|
||||
|
||||
identityKey = KeyHelper.generateIdentityKeyPair();
|
||||
identityKey = KeyUtils.generateIdentityKeyPair();
|
||||
registrationId = KeyHelper.generateRegistrationId(false);
|
||||
password = KeyUtils.createPassword();
|
||||
final SleepTimer timer = new UptimeSleepTimer();
|
||||
|
|
|
@ -3,6 +3,11 @@ package org.asamk.signal.manager.util;
|
|||
import org.asamk.signal.util.RandomUtils;
|
||||
import org.signal.zkgroup.InvalidInputException;
|
||||
import org.signal.zkgroup.profiles.ProfileKey;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
||||
import org.whispersystems.util.Base64;
|
||||
|
||||
|
@ -11,6 +16,14 @@ public class KeyUtils {
|
|||
private KeyUtils() {
|
||||
}
|
||||
|
||||
public static IdentityKeyPair generateIdentityKeyPair() {
|
||||
ECKeyPair djbKeyPair = Curve.generateKeyPair();
|
||||
IdentityKey djbIdentityKey = new IdentityKey(djbKeyPair.getPublicKey());
|
||||
ECPrivateKey djbPrivateKey = djbKeyPair.getPrivateKey();
|
||||
|
||||
return new IdentityKeyPair(djbIdentityKey, djbPrivateKey);
|
||||
}
|
||||
|
||||
public static String createSignalingKey() {
|
||||
return getSecret(52);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue