Class OmemoKeyUtil.Bundle

java.lang.Object
org.jivesoftware.smackx.omemo.util.OmemoKeyUtil.Bundle
Enclosing class:
OmemoKeyUtil<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_ECPub,T_Bundle>

public class OmemoKeyUtil.Bundle extends Object
Bundle related methods.
  • Constructor Details

    • Bundle

      public Bundle()
  • Method Details

    • identityKey

      public T_IdKey identityKey(OmemoBundleElement bundle) throws CorruptedOmemoKeyException
      Extract an IdentityKey from a OmemoBundleElement.
      Parameters:
      bundle - OmemoBundleElement
      Returns:
      identityKey of the bundle
      Throws:
      CorruptedOmemoKeyException - if the key is damaged/malformed
    • signedPreKeyPublic

      public T_ECPub signedPreKeyPublic(OmemoBundleElement bundle) throws CorruptedOmemoKeyException
      Extract a signedPreKey from an OmemoBundleElement.
      Parameters:
      bundle - OmemoBundleElement
      Returns:
      signed preKey
      Throws:
      CorruptedOmemoKeyException - if the key is damaged/malformed
    • signedPreKeyId

      public int signedPreKeyId(OmemoBundleElement bundle)
      Extract the id of the transported signedPreKey from the bundle.
      Parameters:
      bundle - OmemoBundleElement
      Returns:
      id of the signed preKey
    • signedPreKeySignature

      public byte[] signedPreKeySignature(OmemoBundleElement bundle)
      Extract the signature of the signedPreKey in the bundle as a byte array.
      Parameters:
      bundle - OmemoBundleElement
      Returns:
      signature on the signed preKey
    • preKeyPublic

      public T_ECPub preKeyPublic(OmemoBundleElement bundle, int keyId) throws CorruptedOmemoKeyException
      Extract the preKey with id 'keyId' from the bundle.
      Parameters:
      bundle - OmemoBundleElement
      keyId - id of the preKey
      Returns:
      the preKey
      Throws:
      CorruptedOmemoKeyException - when the key cannot be parsed from bytes
    • bundles

      public Map<Integer,T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException
      Break up the OmemoBundleElement into a list of crypto-lib specific bundles (T_PreKey). In case of the signal library, we break the OmemoBundleElement in ~100 PreKeyBundles (one for every transported preKey).
      Parameters:
      bundle - OmemoBundleElement containing multiple PreKeys
      contact - Contact that the bundle belongs to
      Returns:
      a HashMap with one T_Bundle per preKey and the preKeyId as key
      Throws:
      CorruptedOmemoKeyException - when one of the keys cannot be parsed