Пример #1
0
 public void regenerateKeys() {
   axolotlStore.regenerate();
   sessions.clear();
   fetchStatusMap.clear();
   publishBundlesIfNeeded();
   publishOwnDeviceIdIfNeeded();
 }
Пример #2
0
  public XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceivingPayloadMessage(
      XmppAxolotlMessage message) {
    XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = null;

    XmppAxolotlSession session = getReceivingSession(message);
    try {
      plaintextMessage = message.decrypt(session, getOwnDeviceId());
      Integer preKeyId = session.getPreKeyId();
      if (preKeyId != null) {
        publishBundlesIfNeeded();
        session.resetPreKeyId();
      }
    } catch (CryptoFailedException e) {
      Log.w(Config.LOGTAG, getLogprefix(account) + "Failed to decrypt message: " + e.getMessage());
    }

    if (session.isFresh() && plaintextMessage != null) {
      sessions.put(session);
    }

    return plaintextMessage;
  }