Signal Protocol in Flutter

515 views Asked by At

I am building a chat application with flutter. I am using the libsignal_protocol_hive_store package which depends on the libsignal_protocol_dart package to encrypt messages. An encrypted message looks something like this:

{"msg":"MwohBfSQtKNmgh7qokkM4dGqxILAtj5CBqqDPYw9fxrLNaowEAEYACJQ9fcdabyIawEWsciqTsOFIMkITi4big3ASqZU28P33KF+/kYJ+B7u50njYrbYn/F4l9ab/k4lBZe1Ps2bk4DYd5a56VxfvHPcdxTuwINBzSSSh+ECjZ0kIg==","type":2}

My question would be, does this encrypted message provide Confidentiality, Integrity, and Authenticity?

Or does it only provide Confidentiality and I need to send a signature of the message together with the encrypted message?

This is how I get a encrypted message.

  Future<String?> getEncryptedMessage() async {
    Box<HiveSignalKeyStoreModel> keysBox = await Hive.openBox<HiveSignalKeyStoreModel>("signalKeysBox");

    HiveSignalKeyStoreModel? tempMe = keysBox!.get(me);
    if (tempMe == null) {
      tempMe = HiveSignalKeyStoreModel.generateFreshKeys(preKeysCount: 10);
      await keysBox!.put(me, tempMe);
    }

    SignalHelperModel myModel = SignalHelperModel(
      name: me,
      signalStore: HiveSignalProtocolStore(tempMe),
      senderKeyStore: HiveSenderKeyStore(tempMe),
    );

    
   String? encryptedMessage = await myModel.getEncryptedText(messageData.toString(), "friend");
 
   return encryptedMessage;
  }

0

There are 0 answers