Class OmemoBundleElement

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.FullyQualifiedElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlLangElement
    Direct Known Subclasses:
    OmemoBundleElement_VAxolotl

    public abstract class OmemoBundleElement
    extends java.lang.Object
    implements org.jivesoftware.smack.packet.ExtensionElement
    Class that represents an OMEMO Bundle element.
    • Constructor Summary

      Constructors 
      Constructor Description
      OmemoBundleElement​(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, java.util.HashMap<java.lang.Integer,​byte[]> preKeys)
      Constructor to create a Bundle Element from decoded byte arrays.
      OmemoBundleElement​(int signedPreKeyId, java.lang.String signedPreKeyB64, java.lang.String signedPreKeySigB64, java.lang.String identityKeyB64, java.util.HashMap<java.lang.Integer,​java.lang.String> preKeysB64)
      Constructor to create a Bundle Element from base64 Strings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      java.lang.String getElementName()  
      byte[] getIdentityKey()
      Return the public identityKey of the bundles owner.
      byte[] getPreKey​(int id)
      Return a single preKey from the map.
      java.util.HashMap<java.lang.Integer,​byte[]> getPreKeys()
      Return the HashMap of preKeys in the bundle.
      byte[] getSignedPreKey()
      Return the signedPreKey of the OmemoBundleElement.
      int getSignedPreKeyId()
      Return the id of the signedPreKey in the bundle.
      byte[] getSignedPreKeySignature()
      Get the signature of the signedPreKey.
      int hashCode()  
      java.lang.String toString()  
      org.jivesoftware.smack.util.XmlStringBuilder toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.packet.Element

        toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement

        getLanguage, getNamespace, getQName
    • Constructor Detail

      • OmemoBundleElement

        public OmemoBundleElement​(int signedPreKeyId,
                                  java.lang.String signedPreKeyB64,
                                  java.lang.String signedPreKeySigB64,
                                  java.lang.String identityKeyB64,
                                  java.util.HashMap<java.lang.Integer,​java.lang.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 - HashMap of base64 encoded preKeys
      • OmemoBundleElement

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

      • 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 java.util.HashMap<java.lang.Integer,​byte[]> getPreKeys()
        Return the HashMap 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 java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object