Class PkMessage

java.lang.Object
io.github.fherbreteau.vodozemac.backup.PkMessage

public final class PkMessage extends Object
A message that was encrypted using a PkEncryption object.

A PkMessage consists of three base64-encoded components:

  • The ciphertext, produced by AES-CBC encryption of the plaintext
  • The MAC (message authentication code), intended to authenticate the message
  • The ephemeral Curve25519 public key used to derive the message key via X25519 ECDH

Warning: As stated in the PkEncryption class documentation, the MAC does not authenticate the ciphertext. The MAC is computed over an empty message rather than the actual ciphertext, meaning tampering with the ciphertext will not be detected.

Author:
François HERBRETEAU
See Also:
  • Method Details

    • ciphertext

      public String ciphertext()
      Returns the base64-encoded ciphertext of the message.
      Returns:
      the ciphertext as a base64 string
    • mac

      public String mac()
      Returns the base64-encoded MAC (message authentication code) of the message.

      Warning: The MAC does not authenticate the ciphertext. See the PkEncryption class documentation for details.

      Returns:
      the MAC as a base64 string
    • ephemeralKey

      public String ephemeralKey()
      Returns the base64-encoded ephemeral Curve25519 public key used to derive the message key for this message.
      Returns:
      the ephemeral key as a base64 string
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object