public class KeyHelper
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static IdentityKeyPair |
generateIdentityKeyPair()
Generate an identity key pair.
|
static java.util.List<PreKeyRecord> |
generatePreKeys(int start,
int count)
Generate a list of PreKeys.
|
static int |
generateRegistrationId(boolean extendedRange)
Generate a registration ID.
|
static byte[] |
generateSenderKey() |
static int |
generateSenderKeyId() |
static ECKeyPair |
generateSenderSigningKey() |
static SignedPreKeyRecord |
generateSignedPreKey(IdentityKeyPair identityKeyPair,
int signedPreKeyId)
Generate a signed PreKey
|
static int |
getRandomSequence(int max) |
public static IdentityKeyPair generateIdentityKeyPair()
public static int generateRegistrationId(boolean extendedRange)
extendedRange - By default (false), the generated registration
ID is sized to require the minimal possible protobuf
encoding overhead. Specify true if the caller needs
the full range of MAX_INT at the cost of slightly
higher encoding overhead.public static int getRandomSequence(int max)
public static java.util.List<PreKeyRecord> generatePreKeys(int start, int count)
PreKey IDs are shorts, so they will eventually be repeated. Clients should store PreKeys in a circular buffer, so that they are repeated as infrequently as possible.
start - The starting PreKey ID, inclusive.count - The number of PreKeys to generate.public static SignedPreKeyRecord generateSignedPreKey(IdentityKeyPair identityKeyPair, int signedPreKeyId) throws InvalidKeyException
identityKeyPair - The local client's identity key pair.signedPreKeyId - The PreKey id to assign the generated signed PreKeyInvalidKeyException - when the provided identity key is invalidpublic static ECKeyPair generateSenderSigningKey()
public static byte[] generateSenderKey()
public static int generateSenderKeyId()