Class OmemoBundleElement
- java.lang.Object
-
- org.jivesoftware.smackx.omemo.element.OmemoBundleElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
- Direct Known Subclasses:
OmemoBundleElement_VAxolotl
public abstract class OmemoBundleElement extends java.lang.Object implements ExtensionElement
Class that represents an OMEMO Bundle element.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BUNDLE
static java.lang.String
IDENTITY_KEY
static java.lang.String
PRE_KEY_ID
static java.lang.String
PRE_KEY_PUB
static java.lang.String
PRE_KEYS
static java.lang.String
SIGNED_PRE_KEY_ID
static java.lang.String
SIGNED_PRE_KEY_PUB
static java.lang.String
SIGNED_PRE_KEY_SIG
-
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()
Returns the root element name.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()
XmlStringBuilder
toXML(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.FullyQualifiedElement
getLanguage, getNamespace, getQName
-
-
-
-
Field Detail
-
BUNDLE
public static final java.lang.String BUNDLE
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_PUB
public static final java.lang.String SIGNED_PRE_KEY_PUB
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_ID
public static final java.lang.String SIGNED_PRE_KEY_ID
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_SIG
public static final java.lang.String SIGNED_PRE_KEY_SIG
- See Also:
- Constant Field Values
-
IDENTITY_KEY
public static final java.lang.String IDENTITY_KEY
- See Also:
- Constant Field Values
-
PRE_KEYS
public static final java.lang.String PRE_KEYS
- See Also:
- Constant Field Values
-
PRE_KEY_PUB
public static final java.lang.String PRE_KEY_PUB
- See Also:
- Constant Field Values
-
PRE_KEY_ID
public static final java.lang.String PRE_KEY_ID
- See Also:
- Constant Field Values
-
-
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
- idsignedPreKeyB64
- base64 encoded signedPreKeysignedPreKeySigB64
- base64 encoded signedPreKeySignatureidentityKeyB64
- base64 encoded identityKeypreKeysB64
- 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
- idsignedPreKey
- signedPreKeysignedPreKeySig
- signedPreKeySignatureidentityKey
- identityKeypreKeys
- 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()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-