Improve Javadoc readability by adding separating lines

This commit is contained in:
Paul Schaub 2019-12-13 18:30:43 +01:00
parent 85ff749d89
commit 6d0bf04c1e
12 changed files with 103 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public class SignalCachingOmemoStore extends CachingOmemoStore<IdentityKeyPair,
/** /**
* Create a new SignalCachingOmemoStore as a caching layer around a persisting OmemoStore * Create a new SignalCachingOmemoStore as a caching layer around a persisting OmemoStore
* (eg. a SignalFileBasedOmemoStore). * (eg. a SignalFileBasedOmemoStore).
*
* @param wrappedStore other store implementation that gets wrapped * @param wrappedStore other store implementation that gets wrapped
*/ */
public SignalCachingOmemoStore(OmemoStore<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord, public SignalCachingOmemoStore(OmemoStore<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord,

View File

@ -277,9 +277,12 @@ public final class OmemoManager extends Manager {
/** /**
* Return a set of all OMEMO capable devices of a contact. * Return a set of all OMEMO capable devices of a contact.
* Note, that this method does not explicitly refresh the device list of the contact, so it might be outdated. * Note, that this method does not explicitly refresh the device list of the contact, so it might be outdated.
*
* @see #requestDeviceListUpdateFor(BareJid) * @see #requestDeviceListUpdateFor(BareJid)
*
* @param contact contact we want to get a set of device of. * @param contact contact we want to get a set of device of.
* @return set of known devices of that contact. * @return set of known devices of that contact.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public Set<OmemoDevice> getDevicesOf(BareJid contact) throws IOException { public Set<OmemoDevice> getDevicesOf(BareJid contact) throws IOException {
@ -300,6 +303,7 @@ public final class OmemoManager extends Manager {
* @param recipient recipients bareJid * @param recipient recipients bareJid
* @param message text to encrypt * @param message text to encrypt
* @return encrypted message * @return encrypted message
*
* @throws CryptoFailedException when something crypto related fails * @throws CryptoFailedException when something crypto related fails
* @throws UndecidedOmemoIdentityException When there are undecided devices * @throws UndecidedOmemoIdentityException When there are undecided devices
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
@ -323,6 +327,7 @@ public final class OmemoManager extends Manager {
* @param recipients recipients barejids * @param recipients recipients barejids
* @param message text to encrypt * @param message text to encrypt
* @return encrypted message. * @return encrypted message.
*
* @throws CryptoFailedException When something crypto related fails * @throws CryptoFailedException When something crypto related fails
* @throws UndecidedOmemoIdentityException When there are undecided devices. * @throws UndecidedOmemoIdentityException When there are undecided devices.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
@ -349,6 +354,7 @@ public final class OmemoManager extends Manager {
* @param muc multiUserChat * @param muc multiUserChat
* @param message message to send * @param message message to send
* @return encrypted message * @return encrypted message
*
* @throws UndecidedOmemoIdentityException when there are undecided devices. * @throws UndecidedOmemoIdentityException when there are undecided devices.
* @throws CryptoFailedException if the OMEMO cryptography failed. * @throws CryptoFailedException if the OMEMO cryptography failed.
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
@ -403,6 +409,7 @@ public final class OmemoManager extends Manager {
* *
* @param mamQuery The MAM query * @param mamQuery The MAM query
* @return list of decrypted OmemoMessages * @return list of decrypted OmemoMessages
*
* @throws SmackException.NotLoggedInException if the Manager is not authenticated. * @throws SmackException.NotLoggedInException if the Manager is not authenticated.
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
@ -431,6 +438,7 @@ public final class OmemoManager extends Manager {
* Distrust the fingerprint/OmemoDevice tuple. * Distrust the fingerprint/OmemoDevice tuple.
* The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must * The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must
* be of length 64. * be of length 64.
*
* @param device device * @param device device
* @param fingerprint fingerprint * @param fingerprint fingerprint
*/ */
@ -446,6 +454,7 @@ public final class OmemoManager extends Manager {
* Returns true, if the fingerprint/OmemoDevice tuple is trusted, otherwise false. * Returns true, if the fingerprint/OmemoDevice tuple is trusted, otherwise false.
* The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must * The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must
* be of length 64. * be of length 64.
*
* @param device device * @param device device
* @param fingerprint fingerprint * @param fingerprint fingerprint
* @return <code>true</code> if this is a trusted OMEMO identity. * @return <code>true</code> if this is a trusted OMEMO identity.
@ -462,6 +471,7 @@ public final class OmemoManager extends Manager {
* Returns true, if the fingerprint/OmemoDevice tuple is decided by the user. * Returns true, if the fingerprint/OmemoDevice tuple is decided by the user.
* The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must * The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must
* be of length 64. * be of length 64.
*
* @param device device * @param device device
* @param fingerprint fingerprint * @param fingerprint fingerprint
* @return <code>true</code> if the trust is decided for the identity. * @return <code>true</code> if the trust is decided for the identity.
@ -479,6 +489,7 @@ public final class OmemoManager extends Manager {
* secrecy. * secrecy.
* *
* @param recipient recipient * @param recipient recipient
*
* @throws CorruptedOmemoKeyException When the used identityKeys are corrupted * @throws CorruptedOmemoKeyException When the used identityKeys are corrupted
* @throws CryptoFailedException When something fails with the crypto * @throws CryptoFailedException When something fails with the crypto
* @throws CannotEstablishOmemoSessionException When we can't establish a session with the recipient * @throws CannotEstablishOmemoSessionException When we can't establish a session with the recipient
@ -511,6 +522,7 @@ public final class OmemoManager extends Manager {
* *
* @param contact contact * @param contact contact
* @return true if contact has at least one OMEMO capable device. * @return true if contact has at least one OMEMO capable device.
*
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws SmackException.NoResponseException if there was no response from the remote entity. * @throws SmackException.NoResponseException if there was no response from the remote entity.
@ -551,6 +563,7 @@ public final class OmemoManager extends Manager {
* @param connection XMPPConnection * @param connection XMPPConnection
* @param server domainBareJid of the server to test * @param server domainBareJid of the server to test
* @return true if server supports pep * @return true if server supports pep
*
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
@ -614,6 +627,7 @@ public final class OmemoManager extends Manager {
/** /**
* Return all OmemoFingerprints of active devices of a contact. * Return all OmemoFingerprints of active devices of a contact.
* TODO: Make more fail-safe * TODO: Make more fail-safe
*
* @param contact contact * @param contact contact
* @return Map of all active devices of the contact and their fingerprints. * @return Map of all active devices of the contact and their fingerprints.
* *
@ -661,6 +675,7 @@ public final class OmemoManager extends Manager {
/** /**
* Remove an OmemoMessageListener. * Remove an OmemoMessageListener.
*
* @param listener OmemoMessageListener * @param listener OmemoMessageListener
*/ */
public void removeOmemoMessageListener(OmemoMessageListener listener) { public void removeOmemoMessageListener(OmemoMessageListener listener) {
@ -678,6 +693,7 @@ public final class OmemoManager extends Manager {
/** /**
* Remove an OmemoMucMessageListener. * Remove an OmemoMucMessageListener.
*
* @param listener OmemoMucMessageListener * @param listener OmemoMucMessageListener
*/ */
public void removeOmemoMucMessageListener(OmemoMucMessageListener listener) { public void removeOmemoMucMessageListener(OmemoMucMessageListener listener) {
@ -688,6 +704,7 @@ public final class OmemoManager extends Manager {
* Request a deviceList update from contact contact. * Request a deviceList update from contact contact.
* *
* @param contact contact we want to obtain the deviceList from. * @param contact contact we want to obtain the deviceList from.
*
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws PubSubException.NotALeafNodeException if a PubSub leaf node operation was attempted on a non-leaf node. * @throws PubSubException.NotALeafNodeException if a PubSub leaf node operation was attempted on a non-leaf node.
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
@ -750,6 +767,7 @@ public final class OmemoManager extends Manager {
/** /**
* Return true, if the given Stanza contains an OMEMO element 'encrypted'. * Return true, if the given Stanza contains an OMEMO element 'encrypted'.
*
* @param stanza stanza * @param stanza stanza
* @return true if stanza has extension 'encrypted' * @return true if stanza has extension 'encrypted'
*/ */
@ -812,6 +830,7 @@ public final class OmemoManager extends Manager {
/** /**
* Set the deviceId of the manager to nDeviceId. * Set the deviceId of the manager to nDeviceId.
*
* @param nDeviceId new deviceId * @param nDeviceId new deviceId
*/ */
synchronized void setDeviceId(int nDeviceId) { synchronized void setDeviceId(int nDeviceId) {

View File

@ -82,6 +82,7 @@ public class OmemoMessage {
/** /**
* Create a new outgoing OMEMO message. * Create a new outgoing OMEMO message.
*
* @param element OmemoElement * @param element OmemoElement
* @param key messageKey (or transported key) * @param key messageKey (or transported key)
* @param iv initialization vector belonging to key * @param iv initialization vector belonging to key
@ -97,6 +98,7 @@ public class OmemoMessage {
/** /**
* Return a list of all devices the sender originally intended to encrypt the message for. * Return a list of all devices the sender originally intended to encrypt the message for.
*
* @return list of intended recipients. * @return list of intended recipients.
*/ */
public Set<OmemoDevice> getIntendedDevices() { public Set<OmemoDevice> getIntendedDevices() {
@ -105,6 +107,7 @@ public class OmemoMessage {
/** /**
* Return a map of all skipped recipients and the reasons for skipping. * Return a map of all skipped recipients and the reasons for skipping.
*
* @return map of skipped recipients and reasons for that. * @return map of skipped recipients and reasons for that.
*/ */
public HashMap<OmemoDevice, Throwable> getSkippedDevices() { public HashMap<OmemoDevice, Throwable> getSkippedDevices() {
@ -113,6 +116,7 @@ public class OmemoMessage {
/** /**
* Determine, if some recipients were skipped during encryption. * Determine, if some recipients were skipped during encryption.
*
* @return true if recipients were skipped. * @return true if recipients were skipped.
*/ */
public boolean isMissingRecipients() { public boolean isMissingRecipients() {
@ -156,6 +160,7 @@ public class OmemoMessage {
/** /**
* Create a new incoming OMEMO message. * Create a new incoming OMEMO message.
*
* @param element original OmemoElement * @param element original OmemoElement
* @param key message key (or transported key) * @param key message key (or transported key)
* @param iv respective initialization vector * @param iv respective initialization vector
@ -174,6 +179,7 @@ public class OmemoMessage {
/** /**
* Return the decrypted body of the message. * Return the decrypted body of the message.
*
* @return decrypted body * @return decrypted body
*/ */
public String getBody() { public String getBody() {
@ -182,6 +188,7 @@ public class OmemoMessage {
/** /**
* Return the fingerprint of the messages sender device. * Return the fingerprint of the messages sender device.
*
* @return fingerprint of sender * @return fingerprint of sender
*/ */
public OmemoFingerprint getSendersFingerprint() { public OmemoFingerprint getSendersFingerprint() {
@ -199,6 +206,7 @@ public class OmemoMessage {
/** /**
* Return true, if this message was sent as a preKeyMessage. * Return true, if this message was sent as a preKeyMessage.
*
* @return preKeyMessage or not * @return preKeyMessage or not
*/ */
boolean isPreKeyMessage() { boolean isPreKeyMessage() {
@ -208,6 +216,7 @@ public class OmemoMessage {
/** /**
* Return true, if the message was a KeyTransportMessage. * Return true, if the message was a KeyTransportMessage.
* A KeyTransportMessage is a OmemoMessage without a payload. * A KeyTransportMessage is a OmemoMessage without a payload.
*
* @return keyTransportMessage? * @return keyTransportMessage?
*/ */
public boolean isKeyTransportMessage() { public boolean isKeyTransportMessage() {

View File

@ -86,6 +86,7 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param element omemoElement * @param element omemoElement
* @return tuple of cipher generated from the unpacked message key and the auth-tag * @return tuple of cipher generated from the unpacked message key and the auth-tag
*
* @throws CryptoFailedException if decryption using the double ratchet fails * @throws CryptoFailedException if decryption using the double ratchet fails
* @throws NoRawSessionException if we have no session, but the element was NOT a PreKeyMessage * @throws NoRawSessionException if we have no session, but the element was NOT a PreKeyMessage
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
@ -154,6 +155,7 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param element omemoElement containing a payload. * @param element omemoElement containing a payload.
* @param cipherAndAuthTag cipher and authentication tag. * @param cipherAndAuthTag cipher and authentication tag.
* @return decrypted plain text. * @return decrypted plain text.
*
* @throws CryptoFailedException if decryption using AES key fails. * @throws CryptoFailedException if decryption using AES key fails.
*/ */
static String decryptMessageElement(OmemoElement element, CipherAndAuthTag cipherAndAuthTag) static String decryptMessageElement(OmemoElement element, CipherAndAuthTag cipherAndAuthTag)

View File

@ -98,6 +98,7 @@ import org.jxmpp.jid.Jid;
* @param <T_ECPub> Elliptic Curve PublicKey class * @param <T_ECPub> Elliptic Curve PublicKey class
* @param <T_Bundle> Bundle class * @param <T_Bundle> Bundle class
* @param <T_Ciph> Cipher class * @param <T_Ciph> Cipher class
*
* @author Paul Schaub * @author Paul Schaub
*/ */
public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
@ -113,10 +114,12 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
private final HashMap<OmemoManager, OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>> omemoRatchets = new HashMap<>(); private final HashMap<OmemoManager, OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>> omemoRatchets = new HashMap<>();
protected OmemoService() { protected OmemoService() {
} }
/** /**
* Return the singleton instance of this class. When no instance is set, throw an IllegalStateException instead. * Return the singleton instance of this class. When no instance is set, throw an IllegalStateException instead.
*
* @return instance. * @return instance.
*/ */
public static OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> getInstance() { public static OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> getInstance() {
@ -226,6 +229,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* Initialize OMEMO functionality for the given {@link OmemoManager}. * Initialize OMEMO functionality for the given {@link OmemoManager}.
* *
* @param managerGuard OmemoManager we'd like to initialize. * @param managerGuard OmemoManager we'd like to initialize.
*
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws CorruptedOmemoKeyException if the OMEMO key is corrupted. * @throws CorruptedOmemoKeyException if the OMEMO key is corrupted.
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
@ -266,6 +270,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param managerGuard Logged in OmemoManager * @param managerGuard Logged in OmemoManager
* @param contactsDevice OmemoDevice of the contact * @param contactsDevice OmemoDevice of the contact
* @return ratchet update message * @return ratchet update message
*
* @throws NoSuchAlgorithmException if AES algorithms are not supported on this system. * @throws NoSuchAlgorithmException if AES algorithms are not supported on this system.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws SmackException.NoResponseException if there was no response from the remote entity. * @throws SmackException.NoResponseException if there was no response from the remote entity.
@ -428,6 +433,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Decrypt an OMEMO message. * Decrypt an OMEMO message.
*
* @param managerGuard authenticated OmemoManager. * @param managerGuard authenticated OmemoManager.
* @param senderJid BareJid of the sender. * @param senderJid BareJid of the sender.
* @param omemoElement omemoElement. * @param omemoElement omemoElement.
@ -477,6 +483,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Create an OMEMO KeyTransportElement. * Create an OMEMO KeyTransportElement.
*
* @see <a href="https://xmpp.org/extensions/xep-0384.html#usecases-keysend">XEP-0384: Sending a key</a>. * @see <a href="https://xmpp.org/extensions/xep-0384.html#usecases-keysend">XEP-0384: Sending a key</a>.
* *
* @param managerGuard Initialized OmemoManager. * @param managerGuard Initialized OmemoManager.
@ -572,9 +579,11 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Publish the given OMEMO bundle to the server using PubSub. * Publish the given OMEMO bundle to the server using PubSub.
*
* @param connection our connection. * @param connection our connection.
* @param userDevice our device * @param userDevice our device
* @param bundle the bundle we want to publish * @param bundle the bundle we want to publish
*
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
@ -625,8 +634,10 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Publish the given device list to the server. * Publish the given device list to the server.
*
* @param connection authenticated XMPP connection. * @param connection authenticated XMPP connection.
* @param deviceList users deviceList. * @param deviceList users deviceList.
*
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.
@ -758,6 +769,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param connection authenticated XMPP connection * @param connection authenticated XMPP connection
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @param contactsDevice OmemoDevice of a contact. * @param contactsDevice OmemoDevice of a contact.
*
* @throws CannotEstablishOmemoSessionException if we cannot establish a session (because of missing bundle etc.) * @throws CannotEstablishOmemoSessionException if we cannot establish a session (because of missing bundle etc.)
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
@ -794,6 +806,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Build sessions with all devices from the set, we don't have a session with yet. * Build sessions with all devices from the set, we don't have a session with yet.
* Return the set of all devices we have a session with afterwards. * Return the set of all devices we have a session with afterwards.
*
* @param connection authenticated XMPP connection * @param connection authenticated XMPP connection
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @param devices set of devices we may want to build a session with if necessary * @param devices set of devices we may want to build a session with if necessary
@ -841,6 +854,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param callback OmemoTrustCallback to query the trust decisions from * @param callback OmemoTrustCallback to query the trust decisions from
* @param devices set of OmemoDevices * @param devices set of OmemoDevices
* @return set of OmemoDevices which contains all devices from the set devices, which are undecided * @return set of OmemoDevices which contains all devices from the set devices, which are undecided
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private Set<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, OmemoTrustCallback callback, Set<OmemoDevice> devices) throws IOException { private Set<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, OmemoTrustCallback callback, Set<OmemoDevice> devices) throws IOException {
@ -871,6 +885,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice OmemoDevice of the contact. * @param contactsDevice OmemoDevice of the contact.
* @return true if userDevice has session with contactsDevice. * @return true if userDevice has session with contactsDevice.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private boolean hasSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException { private boolean hasSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException {
@ -883,6 +898,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param omemoManager our OmemoManager * @param omemoManager our OmemoManager
* @param contactsBundle bundle of the contact * @param contactsBundle bundle of the contact
* @param contactsDevice OmemoDevice of the contact * @param contactsDevice OmemoDevice of the contact
*
* @throws CorruptedOmemoKeyException if the OMEMO key is corrupted. * @throws CorruptedOmemoKeyException if the OMEMO key is corrupted.
*/ */
protected abstract void processBundle(OmemoManager omemoManager, protected abstract void processBundle(OmemoManager omemoManager,
@ -895,6 +911,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @return true if rotation is necessary * @return true if rotation is necessary
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) throws IOException { private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) throws IOException {
@ -924,6 +941,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @return our altered deviceList with stale devices marked as inactive. * @return our altered deviceList with stale devices marked as inactive.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private OmemoCachedDeviceList deleteStaleDevices(OmemoDevice userDevice) throws IOException { private OmemoCachedDeviceList deleteStaleDevices(OmemoDevice userDevice) throws IOException {
@ -944,6 +962,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param contact subjects BareJid. * @param contact subjects BareJid.
* @param contactsDeviceList subjects deviceList. * @param contactsDeviceList subjects deviceList.
* @return copy of subjects deviceList with stale devices marked as inactive. * @return copy of subjects deviceList with stale devices marked as inactive.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice, private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice,
@ -1220,6 +1239,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param stanza stanza * @param stanza stanza
* @param managerGuard authenticated OmemoManager * @param managerGuard authenticated OmemoManager
* @return decrypted OmemoMessage or null * @return decrypted OmemoMessage or null
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
OmemoMessage.Received decryptStanza(Stanza stanza, OmemoManager.LoggedInOmemoManager managerGuard) throws IOException { OmemoMessage.Received decryptStanza(Stanza stanza, OmemoManager.LoggedInOmemoManager managerGuard) throws IOException {
@ -1301,6 +1321,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param managerGuard authenticated OmemoManager. * @param managerGuard authenticated OmemoManager.
* @param brokenDevice device which session broke. * @param brokenDevice device which session broke.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private void repairBrokenSessionWithPreKeyMessage(OmemoManager.LoggedInOmemoManager managerGuard, private void repairBrokenSessionWithPreKeyMessage(OmemoManager.LoggedInOmemoManager managerGuard,
@ -1356,6 +1377,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
/** /**
* Return the joined MUC with EntityBareJid jid, or null if its not a room and/or not joined. * Return the joined MUC with EntityBareJid jid, or null if its not a room and/or not joined.
*
* @param connection xmpp connection * @param connection xmpp connection
* @param jid jid (presumably) of the MUC * @param jid jid (presumably) of the MUC
* @return MultiUserChat or null if not a MUC. * @return MultiUserChat or null if not a MUC.
@ -1379,6 +1401,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* Publish a new DeviceList with just our device in it. * Publish a new DeviceList with just our device in it.
* *
* @param managerGuard authenticated OmemoManager. * @param managerGuard authenticated OmemoManager.
*
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
* @throws XMPPException.XMPPErrorException if there was an XMPP error returned. * @throws XMPPException.XMPPErrorException if there was an XMPP error returned.
* @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NotConnectedException if the XMPP connection is not connected.

View File

@ -53,6 +53,7 @@ import org.jxmpp.jid.BareJid;
* @param <T_ECPub> Elliptic Curve PublicKey class * @param <T_ECPub> Elliptic Curve PublicKey class
* @param <T_Bundle> Bundle class * @param <T_Bundle> Bundle class
* @param <T_Ciph> Cipher class * @param <T_Ciph> Cipher class
*
* @author Paul Schaub * @author Paul Schaub
*/ */
public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> { public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> {
@ -68,6 +69,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
/** /**
* Returns a sorted set of all the deviceIds, the localUser has had data stored under in the store. * Returns a sorted set of all the deviceIds, the localUser has had data stored under in the store.
* Basically this returns the deviceIds of all "accounts" of localUser, which are known to the store. * Basically this returns the deviceIds of all "accounts" of localUser, which are known to the store.
*
* @param localUser BareJid of the user. * @param localUser BareJid of the user.
* @return set of deviceIds with available data. * @return set of deviceIds with available data.
*/ */
@ -79,6 +81,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our current device. * @param userDevice our current device.
* @param id deviceId to check for. * @param id deviceId to check for.
* @return true if list did not contain our id, else false * @return true if list did not contain our id, else false
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
boolean isAvailableDeviceId(OmemoDevice userDevice, int id) throws IOException { boolean isAvailableDeviceId(OmemoDevice userDevice, int id) throws IOException {
@ -103,6 +106,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contact Contact we received the list from. * @param contact Contact we received the list from.
* @param list List we received. * @param list List we received.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
OmemoCachedDeviceList mergeCachedDeviceList(OmemoDevice userDevice, BareJid contact, OmemoDeviceListElement list) throws IOException { OmemoCachedDeviceList mergeCachedDeviceList(OmemoDevice userDevice, BareJid contact, OmemoDeviceListElement list) throws IOException {
@ -133,6 +137,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* The old signed PreKey should be kept for around a month or so (look it up in the XEP). * The old signed PreKey should be kept for around a month or so (look it up in the XEP).
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
*
* @throws CorruptedOmemoKeyException when our identityKey is invalid. * @throws CorruptedOmemoKeyException when our identityKey is invalid.
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
* @throws IllegalStateException when our IdentityKeyPair is null. * @throws IllegalStateException when our IdentityKeyPair is null.
@ -163,6 +168,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* Remove the oldest signedPreKey until there are only MAX_NUMBER_OF_STORED_SIGNED_PREKEYS left. * Remove the oldest signedPreKey until there are only MAX_NUMBER_OF_STORED_SIGNED_PREKEYS left.
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
private void removeOldSignedPreKeys(OmemoDevice userDevice) throws IOException { private void removeOldSignedPreKeys(OmemoDevice userDevice) throws IOException {
@ -266,12 +272,14 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param identityKeyPair identityKeyPair * @param identityKeyPair identityKeyPair
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair) throws IOException; public abstract void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair) throws IOException;
/** /**
* Remove the identityKeyPair of a user. * Remove the identityKeyPair of a user.
*
* @param userDevice our device. * @param userDevice our device.
*/ */
public abstract void removeOmemoIdentityKeyPair(OmemoDevice userDevice); public abstract void removeOmemoIdentityKeyPair(OmemoDevice userDevice);
@ -295,6 +303,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice device. * @param contactsDevice device.
* @param contactsKey identityKey belonging to the contactsDevice. * @param contactsKey identityKey belonging to the contactsDevice.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey contactsKey) throws IOException; public abstract void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey contactsKey) throws IOException;
@ -314,6 +323,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our omemoDevice. * @param userDevice our omemoDevice.
* @param contactsDevice device of which we want to set the message counter. * @param contactsDevice device of which we want to set the message counter.
* @param counter counter value. * @param counter counter value.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice, int counter) throws IOException; public abstract void storeOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice, int counter) throws IOException;
@ -326,6 +336,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our omemoDevice * @param userDevice our omemoDevice
* @param contactsDevice device of which we want to get the message counter. * @param contactsDevice device of which we want to get the message counter.
* @return counter value. * @return counter value.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException; public abstract int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException;
@ -336,6 +347,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice omemoManager of our device. * @param userDevice omemoManager of our device.
* @param contactsDevice device in question * @param contactsDevice device in question
* @param date date of the last received message * @param date date of the last received message
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException; public abstract void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException;
@ -346,6 +358,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice device in question * @param contactsDevice device in question
* @return date if existent, null * @return date if existent, null
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException; public abstract Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException;
@ -357,6 +370,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @param contactsDevice OmemoDevice in question * @param contactsDevice OmemoDevice in question
* @param date date of the last publication after not being published * @param date date of the last publication after not being published
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException; public abstract void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException;
@ -368,6 +382,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice * @param userDevice our OmemoDevice
* @param contactsDevice OmemoDevice in question * @param contactsDevice OmemoDevice in question
* @return date of the last publication after not being published * @return date of the last publication after not being published
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException; public abstract Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException;
@ -377,6 +392,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param date date * @param date date
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, Date date) throws IOException; public abstract void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, Date date) throws IOException;
@ -386,6 +402,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @return date if existent, otherwise null * @return date if existent, otherwise null
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws IOException; public abstract Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws IOException;
@ -408,6 +425,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param preKeyId id of the key to be loaded * @param preKeyId id of the key to be loaded
* @return loaded preKey * @return loaded preKey
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract T_PreKey loadOmemoPreKey(OmemoDevice userDevice, int preKeyId) throws IOException; public abstract T_PreKey loadOmemoPreKey(OmemoDevice userDevice, int preKeyId) throws IOException;
@ -418,6 +436,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param preKeyId id of the key * @param preKeyId id of the key
* @param preKey key * @param preKey key
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey preKey) throws IOException; public abstract void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey preKey) throws IOException;
@ -427,6 +446,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param preKeyHashMap HashMap of preKeys * @param preKeyHashMap HashMap of preKeys
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) throws IOException { public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) throws IOException {
@ -449,6 +469,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @return Map containing our preKeys * @return Map containing our preKeys
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException; public abstract TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException;
@ -473,6 +494,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* *
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @return HashMap of our singedPreKeys * @return HashMap of our singedPreKeys
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException; public abstract TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException;
@ -497,6 +519,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param signedPreKeyId id of the signedPreKey * @param signedPreKeyId id of the signedPreKey
* @param signedPreKey the key itself * @param signedPreKey the key itself
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId, T_SigPreKey signedPreKey) throws IOException; public abstract void storeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId, T_SigPreKey signedPreKey) throws IOException;
@ -515,6 +538,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice device whose session we want to load * @param contactsDevice device whose session we want to load
* @return crypto related session * @return crypto related session
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract T_Sess loadRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException; public abstract T_Sess loadRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException;
@ -525,6 +549,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contact BareJid of the contact we want to get all sessions from * @param contact BareJid of the contact we want to get all sessions from
* @return TreeMap of deviceId and sessions of the contact * @return TreeMap of deviceId and sessions of the contact
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException; public abstract HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException;
@ -535,6 +560,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice OmemoDevice whose session we want to store * @param contactsDevice OmemoDevice whose session we want to store
* @param session session * @param session session
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session) throws IOException; public abstract void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session) throws IOException;
@ -571,6 +597,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contact contact we want to get the deviceList of * @param contact contact we want to get the deviceList of
* @return CachedDeviceList of the contact * @return CachedDeviceList of the contact
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice, BareJid contact) throws IOException; public abstract OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice, BareJid contact) throws IOException;
@ -594,6 +621,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contact Contact * @param contact Contact
* @param contactsDeviceList list of the contacts devices' ids. * @param contactsDeviceList list of the contacts devices' ids.
*
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.
*/ */
public abstract void storeCachedDeviceList(OmemoDevice userDevice, public abstract void storeCachedDeviceList(OmemoDevice userDevice,
@ -640,6 +668,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param userDevice our OmemoDevice. * @param userDevice our OmemoDevice.
* @param contactsDevice OmemoDevice we want to have the fingerprint for. * @param contactsDevice OmemoDevice we want to have the fingerprint for.
* @return fingerprint of the userDevices IdentityKey. * @return fingerprint of the userDevices IdentityKey.
*
* @throws CorruptedOmemoKeyException if the IdentityKey is corrupted. * @throws CorruptedOmemoKeyException if the IdentityKey is corrupted.
* @throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally. * @throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally.
* @throws IOException if an I/O error occurred. * @throws IOException if an I/O error occurred.

View File

@ -42,6 +42,7 @@ public class StaleDeviceException extends Exception {
/** /**
* Return the date on which the last OMEMO message sent from the device was received. * Return the date on which the last OMEMO message sent from the device was received.
*
* @return last messages date * @return last messages date
*/ */
public Date getLastMessageDate() { public Date getLastMessageDate() {
@ -50,6 +51,7 @@ public class StaleDeviceException extends Exception {
/** /**
* Return the date of the last time the deviceId was republished after being inactive/non-existent before. * Return the date of the last time the deviceId was republished after being inactive/non-existent before.
*
* @return date of last deviceId (re)publication. * @return date of last deviceId (re)publication.
*/ */
public Date getLastDeviceIdPublicationDate() { public Date getLastDeviceIdPublicationDate() {
@ -58,6 +60,7 @@ public class StaleDeviceException extends Exception {
/** /**
* Return the stale OMEMO device. * Return the stale OMEMO device.
*
* @return stale device * @return stale device
*/ */
public OmemoDevice getDevice() { public OmemoDevice getDevice() {

View File

@ -56,6 +56,7 @@ public class UntrustedOmemoIdentityException extends Exception {
/** /**
* Return the device which sent the message. * Return the device which sent the message.
*
* @return omemoDevice. * @return omemoDevice.
*/ */
public OmemoDevice getDevice() { public OmemoDevice getDevice() {

View File

@ -23,12 +23,14 @@ import org.jivesoftware.smackx.omemo.OmemoMessage;
/** /**
* Listener interface that allows implementations to receive decrypted OMEMO MUC messages. * Listener interface that allows implementations to receive decrypted OMEMO MUC messages.
*
* @author Paul Schaub * @author Paul Schaub
*/ */
public interface OmemoMucMessageListener { public interface OmemoMucMessageListener {
/** /**
* Gets called whenever an OMEMO message has been received in a MultiUserChat and successfully decrypted. * Gets called whenever an OMEMO message has been received in a MultiUserChat and successfully decrypted.
*
* @param muc MultiUserChat the message was sent in * @param muc MultiUserChat the message was sent in
* @param stanza Original Stanza * @param stanza Original Stanza
* @param decryptedOmemoMessage decrypted Omemo message * @param decryptedOmemoMessage decrypted Omemo message

View File

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.omemo.util;
/** /**
* Some constants related to OMEMO. * Some constants related to OMEMO.
*
* @author Paul Schaub * @author Paul Schaub
*/ */
public final class OmemoConstants { public final class OmemoConstants {

View File

@ -101,6 +101,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param bundle OmemoBundleElement * @param bundle OmemoBundleElement
* @param keyId id of the preKey * @param keyId id of the preKey
* @return the preKey * @return the preKey
*
* @throws CorruptedOmemoKeyException when the key cannot be parsed from bytes * @throws CorruptedOmemoKeyException when the key cannot be parsed from bytes
*/ */
public T_ECPub preKeyPublic(OmemoBundleElement bundle, int keyId) throws CorruptedOmemoKeyException { public T_ECPub preKeyPublic(OmemoBundleElement bundle, int keyId) throws CorruptedOmemoKeyException {
@ -115,6 +116,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param bundle OmemoBundleElement containing multiple PreKeys * @param bundle OmemoBundleElement containing multiple PreKeys
* @param contact Contact that the bundle belongs to * @param contact Contact that the bundle belongs to
* @return a HashMap with one T_Bundle per preKey and the preKeyId as key * @return a HashMap with one T_Bundle per preKey and the preKeyId as key
*
* @throws CorruptedOmemoKeyException when one of the keys cannot be parsed * @throws CorruptedOmemoKeyException when one of the keys cannot be parsed
*/ */
public HashMap<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException { public HashMap<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException {
@ -138,6 +140,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param data byte array * @param data byte array
* @return IdentityKeyPair (T_IdKeyPair) * @return IdentityKeyPair (T_IdKeyPair)
*
* @throws CorruptedOmemoKeyException if the key is damaged of malformed * @throws CorruptedOmemoKeyException if the key is damaged of malformed
*/ */
public abstract T_IdKeyPair identityKeyPairFromBytes(byte[] data) throws CorruptedOmemoKeyException; public abstract T_IdKeyPair identityKeyPairFromBytes(byte[] data) throws CorruptedOmemoKeyException;
@ -147,6 +150,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param data byte array * @param data byte array
* @return identityKey (T_IdKey) * @return identityKey (T_IdKey)
*
* @throws CorruptedOmemoKeyException if the key is damaged or malformed * @throws CorruptedOmemoKeyException if the key is damaged or malformed
*/ */
public abstract T_IdKey identityKeyFromBytes(byte[] data) throws CorruptedOmemoKeyException; public abstract T_IdKey identityKeyFromBytes(byte[] data) throws CorruptedOmemoKeyException;
@ -164,6 +168,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param data bytes * @param data bytes
* @return elliptic curve public key (T_ECPub) * @return elliptic curve public key (T_ECPub)
*
* @throws CorruptedOmemoKeyException if the key is damaged or malformed * @throws CorruptedOmemoKeyException if the key is damaged or malformed
*/ */
public abstract T_ECPub ellipticCurvePublicKeyFromBytes(byte[] data) throws CorruptedOmemoKeyException; public abstract T_ECPub ellipticCurvePublicKeyFromBytes(byte[] data) throws CorruptedOmemoKeyException;
@ -193,6 +198,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param bytes byte array * @param bytes byte array
* @return deserialized preKey * @return deserialized preKey
*
* @throws IOException when something goes wrong * @throws IOException when something goes wrong
*/ */
public abstract T_PreKey preKeyFromBytes(byte[] bytes) throws IOException; public abstract T_PreKey preKeyFromBytes(byte[] bytes) throws IOException;
@ -236,6 +242,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param data byte array * @param data byte array
* @return deserialized signed preKey * @return deserialized signed preKey
*
* @throws IOException when something goes wrong * @throws IOException when something goes wrong
*/ */
public abstract T_SigPreKey signedPreKeyFromBytes(byte[] data) throws IOException; public abstract T_SigPreKey signedPreKeyFromBytes(byte[] data) throws IOException;
@ -257,6 +264,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* @param contact Contact that the bundle belongs to * @param contact Contact that the bundle belongs to
* @param keyId id of the preKey that will be selected from the OmemoBundleElement and that the PreKeyBundle will contain * @param keyId id of the preKey that will be selected from the OmemoBundleElement and that the PreKeyBundle will contain
* @return PreKeyBundle (T_PreKey) * @return PreKeyBundle (T_PreKey)
*
* @throws CorruptedOmemoKeyException if some key is damaged or malformed * @throws CorruptedOmemoKeyException if some key is damaged or malformed
*/ */
public abstract T_Bundle bundleFromOmemoBundle(OmemoBundleElement bundle, OmemoDevice contact, int keyId) throws CorruptedOmemoKeyException; public abstract T_Bundle bundleFromOmemoBundle(OmemoBundleElement bundle, OmemoDevice contact, int keyId) throws CorruptedOmemoKeyException;
@ -366,6 +374,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
* *
* @param data bytes * @param data bytes
* @return raw OMEMO Session * @return raw OMEMO Session
*
* @throws IOException when something goes wrong * @throws IOException when something goes wrong
*/ */
public abstract T_Sess rawSessionFromBytes(byte[] data) throws IOException; public abstract T_Sess rawSessionFromBytes(byte[] data) throws IOException;

View File

@ -140,9 +140,11 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* Encrypt the message with the aes key. * Encrypt the message with the aes key.
* Move the AuthTag from the end of the cipherText to the end of the messageKey afterwards. * Move the AuthTag from the end of the cipherText to the end of the messageKey afterwards.
* This prevents an attacker which compromised one recipient device to switch out the cipherText for other recipients. * This prevents an attacker which compromised one recipient device to switch out the cipherText for other recipients.
*
* @see <a href="https://conversations.im/omemo/audit.pdf">OMEMO security audit</a>. * @see <a href="https://conversations.im/omemo/audit.pdf">OMEMO security audit</a>.
* *
* @param message plaintext message * @param message plaintext message
*
* @throws NoSuchPaddingException if the requested padding mechanism is not availble. * @throws NoSuchPaddingException if the requested padding mechanism is not availble.
* @throws InvalidAlgorithmParameterException if the provided arguments are invalid. * @throws InvalidAlgorithmParameterException if the provided arguments are invalid.
* @throws InvalidKeyException if the key is invalid. * @throws InvalidKeyException if the key is invalid.
@ -210,6 +212,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* Add a new recipient device to the message. * Add a new recipient device to the message.
* *
* @param contactsDevice device of the recipient * @param contactsDevice device of the recipient
*
* @throws NoIdentityKeyException if we have no identityKey of that device. Can be fixed by fetching and * @throws NoIdentityKeyException if we have no identityKey of that device. Can be fixed by fetching and
* processing the devices bundle. * processing the devices bundle.
* @throws CorruptedOmemoKeyException if the identityKey of that device is corrupted. * @throws CorruptedOmemoKeyException if the identityKey of that device is corrupted.
@ -260,6 +263,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @param keyType Key Type * @param keyType Key Type
* @param keyLength Key Length in bit * @param keyLength Key Length in bit
* @return new AES key * @return new AES key
*
* @throws NoSuchAlgorithmException if no such algorithm is available. * @throws NoSuchAlgorithmException if no such algorithm is available.
*/ */
public static byte[] generateKey(String keyType, int keyLength) throws NoSuchAlgorithmException { public static byte[] generateKey(String keyType, int keyLength) throws NoSuchAlgorithmException {