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 Object implements ExtensionElement
Class that represents an OMEMO Bundle element.
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUNDLE
static String
IDENTITY_KEY
static String
PRE_KEY_ID
static String
PRE_KEY_PUB
static String
PRE_KEYS
static String
SIGNED_PRE_KEY_ID
static String
SIGNED_PRE_KEY_PUB
static String
SIGNED_PRE_KEY_SIG
-
Constructor Summary
Constructors Constructor Description OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer,byte[]> preKeys)
Constructor to create a Bundle Element from decoded byte arrays.OmemoBundleElement(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, HashMap<Integer,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(Object other)
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.HashMap<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()
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 String BUNDLE
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_PUB
public static final String SIGNED_PRE_KEY_PUB
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_ID
public static final String SIGNED_PRE_KEY_ID
- See Also:
- Constant Field Values
-
SIGNED_PRE_KEY_SIG
public static final String SIGNED_PRE_KEY_SIG
- See Also:
- Constant Field Values
-
IDENTITY_KEY
public static final String IDENTITY_KEY
- See Also:
- Constant Field Values
-
PRE_KEYS
public static final String PRE_KEYS
- See Also:
- Constant Field Values
-
PRE_KEY_PUB
public static final String PRE_KEY_PUB
- See Also:
- Constant Field Values
-
PRE_KEY_ID
public static final String PRE_KEY_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OmemoBundleElement
public OmemoBundleElement(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, HashMap<Integer,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, HashMap<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 HashMap<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 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)
-
-