End To End - SafeSlingerProject/SafeSlinger-Media GitHub Wiki

While we use SSL in all of our client-server transit communications, all messages are truly encrypted end-to-end.

Message Secrecy and Authenticity

When SafeSlinger is first installed, it generates 2 RSA 2048-bit key-pairs and requests a push token to serve as that device’s identity for the push notification service. All keys originate from each users's device so that the server as a service provider cannot know any user's private key, and cannot read the messages. Each user has one key for encryption a separate key for signing. For message encryption and authentication, we choose the PKCS#7 encryption format. One alteration was to use SHA-3 as the hash algorithm for our RSA signature generation instead of SHA-1. Attachments to be included in a message are formatted as a separate PKCS#7 message. Each message contains multiple physical parts:

  • Plaintext push message containing Message Id.
  • Ciphertext Message Packet containing meta-data and (optional) Attachment Id.
  • Ciphertext attachment (optional).

Delivery Sequence

Our delivery sequence was designed in parts to reduce the load on metered or quota bandwidth-limited devices so that users can know attachment sizes before downloading and can make choices appropriate to their network plan.

  1. Sender posts to server: ciphertext meta-data, ciphertext attachment, Message Id, recipient push Id.
  2. Server stores ciphertexts and sends push message containing plaintext Message Id to recipient.
  3. Recipient receives push message with plaintext Message Id.
  4. Recipient downloads Message Packet ciphertext from server.
  5. Recipient decrypts ciphertext Message Packet producing plaintext Message Packet.
  6. Recipient verifies plaintext Message Id = SHA-3 hash of plaintext Message Packet.
  7. Recipient downloads attachment ciphertext from server.
  8. Recipient decrypts ciphertext attachment producing plaintext attachment.
  9. Recipient verifies plaintext Attachment Id = SHA-3 hash of plaintext attachment.

Message Meta-Data

All message meta-data is encrypted including: text message, sender's timestamp, sender name, attachment name, attachment mime-type, attachment size, Attachment Id.

Elliptic-Curve Cryptography

SafeSlinger Messenger does not presently use EC keys. A scheme to introduce algorithm agility is in development that would support ECC and variable key sizes. If you are able to help with the development of an algorithm agility feature to support ECC we love to get pull requests.