Class OmemoBundleElement

java.lang.Object
org.jivesoftware.smackx.omemo.element.OmemoBundleElement
All Implemented Interfaces:
org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement
Direct Known Subclasses:
OmemoBundleElement_VAxolotl

public abstract class OmemoBundleElement extends Object implements org.jivesoftware.smack.packet.ExtensionElement
Class that represents an OMEMO Bundle element.
  • Field Details

  • Constructor Details

    • OmemoBundleElement

      public OmemoBundleElement(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, Map<Integer,String> preKeysB64)
      Constructor to create a Bundle Element from base64 Strings.
      Parameters:
      signedPreKeyId - id
      signedPreKeyB64 - base64 encoded signedPreKey
      signedPreKeySigB64 - base64 encoded signedPreKeySignature
      identityKeyB64 - base64 encoded identityKey
      preKeysB64 - Map of base64 encoded preKeys
    • OmemoBundleElement

      public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, Map<Integer,byte[]> preKeys)
      Constructor to create a Bundle Element from decoded byte arrays.
      Parameters:
      signedPreKeyId - id
      signedPreKey - signedPreKey
      signedPreKeySig - signedPreKeySignature
      identityKey - identityKey
      preKeys - Map of preKeys
  • Method Details

    • getSignedPreKey

      public byte[] getSignedPreKey()
      Return the signedPreKey of the OmemoBundleElement.
      Returns:
      signedPreKey as byte array
    • getSignedPreKeyId

      public int getSignedPreKeyId()
      Return the id of the signedPreKey in the bundle.
      Returns:
      id of signedPreKey
    • getSignedPreKeySignature

      public byte[] getSignedPreKeySignature()
      Get the signature of the signedPreKey.
      Returns:
      signature as byte array
    • getIdentityKey

      public byte[] getIdentityKey()
      Return the public identityKey of the bundles owner. This can be used to check the signedPreKeys signature. The fingerprint of this key is, what the user has to verify.
      Returns:
      public identityKey as byte array
    • getPreKeys

      public Map<Integer,byte[]> getPreKeys()
      Return the Map of preKeys in the bundle. The map uses the preKeys ids as key and the preKeys as value.
      Returns:
      preKeys Pre-Keys contained in the bundle
    • getPreKey

      public byte[] getPreKey(int id)
      Return a single preKey from the map.
      Parameters:
      id - id of the preKey
      Returns:
      the preKey
    • getElementName

      public String getElementName()
      Specified by:
      getElementName in interface org.jivesoftware.smack.packet.NamedElement
    • toXML

      public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
      Specified by:
      toXML in interface org.jivesoftware.smack.packet.Element
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object