Skip to content

#7 Encryption

Akshat Sharma edited this page Dec 13, 2020 · 2 revisions

Entirety of encryption is handled in EncryptionController. This class as following functions:

  • generateKeys(): returns an array of size 2. arr[0] is private key while arr[1] is public key.
  • getEncryptedMessage(): takes a ChatMessage object whose mssgText attribute is plain text and returns a ChatMessage object whose mssgText attribute is encrypted.
  • getDecryptedMessage(): opposite of getEncryptedMessage(). Returns a decrypted plaintext chatMessage.

The controller always encrypts with recipient's public key and decrypts with current user's (sender's) private key.

Where encryption-decryption takes place:

  • All incoming/outgoing radio messages are encrypted.
  • All incoming/outgoing offline messages are encrypted.
  • All incoming/outgoing online messages are encrypted.
  • Any message being stored in local database is decrypted.

EncryptionController can be found in security/EncryptionController.java

Clone this wiki locally