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 java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.logging.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 static final java.util.logging.Logger LOGGER
protected OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> omemoStore
public OmemoService() throws javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, java.io.UnsupportedEncodingException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.InvalidAlgorithmParameterException
javax.crypto.NoSuchPaddingException - When no Cipher could be instantiated.java.security.NoSuchAlgorithmException - when no Cipher could be instantiated.java.security.NoSuchProviderException - when BouncyCastle could not be found.java.security.InvalidAlgorithmParameterException - when the Cipher could not be initializedjava.security.InvalidKeyException - when the generated key is invalidjava.io.UnsupportedEncodingException - when UTF8 is unavailablejavax.crypto.BadPaddingException - when cipher.doFinal gets wrong paddingjavax.crypto.IllegalBlockSizeException - 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 javax.crypto.NoSuchPaddingException, java.io.UnsupportedEncodingException, java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.NoSuchProviderException, java.security.InvalidKeyException
javax.crypto.NoSuchPaddingExceptionjava.io.UnsupportedEncodingExceptionjava.security.InvalidAlgorithmParameterExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidKeyExceptionpublic 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 - OmemoDeviceCorruptedOmemoKeyExceptionprotected 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.CannotEstablishOmemoSessionExceptionCorruptedOmemoKeyExceptionCryptoFailedExceptionUndecidedOmemoIdentityExceptionprotected 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?UndecidedOmemoIdentityExceptionCorruptedOmemoKeyExceptionCryptoFailedExceptionCannotEstablishOmemoSessionException