T_IdKeyPair
- IdentityKeyPair classT_IdKey
- IdentityKey classT_PreKey
- PreKey classT_SigPreKey
- SignedPreKey classT_Sess
- Session classT_Addr
- Address classT_ECPub
- Elliptic Curve PublicKey classT_Bundle
- Bundle classT_Ciph
- Cipher classpublic abstract class OmemoService<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> extends Object
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOGGER |
protected OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> |
omemoStore |
Constructor and Description |
---|
OmemoService()
Create a new OmemoService object.
|
Modifier and Type | Method and Description |
---|---|
void |
buildSessionFromOmemoBundle(OmemoManager omemoManager,
OmemoDevice device,
boolean fresh)
Build an OmemoSession for the given OmemoDevice.
|
protected static void |
checkAvailableAlgorithms()
Test availability of required algorithms.
|
abstract OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> |
createDefaultOmemoStoreBackend()
Create a default OmemoStore object.
|
static OmemoService<?,?,?,?,?,?,?,?,?> |
getInstance() |
protected Message |
getOmemoRatchetUpdateMessage(OmemoManager omemoManager,
OmemoDevice recipient,
boolean preKeyMessage)
Return a new RatchetUpdateMessage.
|
OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> |
getOmemoStoreBackend()
Return the used omemoStore backend.
|
static boolean |
isServiceRegistered() |
protected abstract void |
processBundle(OmemoManager omemoManager,
T_Bundle bundle,
OmemoDevice device)
Process a received bundle.
|
protected void |
sendOmemoRatchetUpdateMessage(OmemoManager omemoManager,
OmemoDevice recipient,
boolean preKeyMessage)
Send an OmemoRatchetUpdateMessage to recipient.
|
protected static void |
setInstance(OmemoService<?,?,?,?,?,?,?,?,?> omemoService)
Set singleton instance.
|
void |
setOmemoStoreBackend(OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> omemoStore)
Set an omemoStore as backend.
|
protected OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> omemoStore
public OmemoService() throws NoSuchPaddingException, InvalidKeyException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException
NoSuchPaddingException
- When no Cipher could be instantiated.NoSuchAlgorithmException
- when no Cipher could be instantiated.NoSuchProviderException
- when BouncyCastle could not be found.InvalidAlgorithmParameterException
- when the Cipher could not be initializedInvalidKeyException
- when the generated key is invalidUnsupportedEncodingException
- when UTF8 is unavailableBadPaddingException
- when cipher.doFinal gets wrong paddingIllegalBlockSizeException
- when cipher.doFinal gets wrong Block size.public static OmemoService<?,?,?,?,?,?,?,?,?> getInstance()
protected static void setInstance(OmemoService<?,?,?,?,?,?,?,?,?> omemoService)
omemoService
- instancepublic static boolean isServiceRegistered()
public OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> getOmemoStoreBackend()
public void setOmemoStoreBackend(OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> omemoStore)
omemoStore
- store.public abstract OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> createDefaultOmemoStoreBackend()
protected static void checkAvailableAlgorithms() throws NoSuchPaddingException, UnsupportedEncodingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidKeyException
public void buildSessionFromOmemoBundle(OmemoManager omemoManager, OmemoDevice device, boolean fresh) throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException
omemoManager
- omemoManagerdevice
- OmemoDevicefresh
- Do we want to build a session even if we already have one?CannotEstablishOmemoSessionException
- when no session could be establishedCorruptedOmemoKeyException
- when the bundle contained an invalid OMEMO identityKeyprotected abstract void processBundle(OmemoManager omemoManager, T_Bundle bundle, OmemoDevice device) throws CorruptedOmemoKeyException
omemoManager
- omemoManager that will process the bundlebundle
- T_Bundle (depends on used Signal/Olm library)device
- OmemoDeviceCorruptedOmemoKeyException
protected Message getOmemoRatchetUpdateMessage(OmemoManager omemoManager, OmemoDevice recipient, boolean preKeyMessage) throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException, CryptoFailedException, UndecidedOmemoIdentityException
omemoManager
- omemoManager of the sending device.recipient
- recipientpreKeyMessage
- if true, a new session will be built for this message (useful to repair broken sessions)
otherwise the message will be encrypted using the existing session.CannotEstablishOmemoSessionException
CorruptedOmemoKeyException
CryptoFailedException
UndecidedOmemoIdentityException
protected void sendOmemoRatchetUpdateMessage(OmemoManager omemoManager, OmemoDevice recipient, boolean preKeyMessage) throws UndecidedOmemoIdentityException, CorruptedOmemoKeyException, CryptoFailedException, CannotEstablishOmemoSessionException
omemoManager
- omemoManager of the sending device.recipient
- recipientpreKeyMessage
- shall this be a preKeyMessage?UndecidedOmemoIdentityException
CorruptedOmemoKeyException
CryptoFailedException
CannotEstablishOmemoSessionException