Commit Graph

172 Commits

Author SHA1 Message Date
Ehren Kret
a3578fa6d4 Bump version to 0.9.2 2021-09-10 10:24:54 -05:00
Ehren Kret
35eccb94d1 Bump version to 0.9.1 2021-09-09 13:07:09 -05:00
Jordan Rose
6026b8474e Bump version to 0.9.0 2021-08-31 14:50:01 -07:00
Jordan Rose
8c5b6af3fa Sealed sender v2: add an InvalidRegistrationId exception/error
This dedicated error is thrown when a recipient has a registration ID
that's out of the range used by Signal [0, 0x3FFF]. These IDs cannot
be encoded in the sealed sender v2 format and are not supported, even
though they don't cause any problems for 1:1 messages.
2021-08-31 13:11:10 -07:00
Jordan Rose
aa486c64a3 Java: preserve underlying exception as the cause of a ProtocolException
Otherwise we'll lose the "cause" message in stack traces.
2021-08-31 12:46:51 -07:00
Jordan Rose
eab0e57640 Java: don't eagerly strip libsignal_client.so; let gradle do it for us
This is a step towards saving the debug info somewhere for the builds
we actually ship.
2021-08-30 12:33:18 -07:00
Jordan Rose
72ba4e6959 Bump version to 0.8.4 2021-08-18 12:13:11 -07:00
Jordan Rose
528aec7e26 Merge pull request #336 from signalapp/cody/bugfix/hex-match-expected-output
Java: Make toStringCondensed match output from other Signal implementations.
2021-07-09 12:46:03 -07:00
Cody Henthorne
b8b6c285ad Java: Make toStringCondensed match output from other Signal implementations. 2021-07-09 15:23:58 -04:00
Jordan Rose
6021535fb5 Bump version to 0.8.3 2021-07-06 12:57:12 -07:00
Jordan Rose
b00c2e3847 Merge pull request #328 from signalapp/jrose/use-more-RustCrypto
Use more RustCrypto
2021-07-02 14:39:10 -07:00
Jordan Rose
1e55bae7db Java: Remove unused JCE-like interface for AES-256-GCM
Not only is it not sufficient for the streaming decryption used by
Android, but we forgot to mark it 'public'.
2021-07-02 10:29:20 -07:00
Jordan Rose
0e78c785ef Java: expose the tag size for Aes256GcmDecryption
If the tag is stored appended to the data (not unusual) it's the
caller's responsibility to split it off, and they need to know how
much to split.
2021-07-02 10:29:20 -07:00
Jordan Rose
d72047a245 Bridge: expose RustCrypto's AES-GCM-SIV instead of our own
Same as before, but for the wrapper exposed to the app languages.
2021-07-01 13:46:20 -07:00
Jordan Rose
9e168226f6 Docker: Fix typo in 3a3476b83: paths are relative to the repo root
This COPY command never should have worked, but the macOS Docker seems
to normalize ../foo to ./foo, so it passed my local testing.
2021-06-28 14:30:38 -07:00
Jordan Rose
348df2a268 Bump version to v0.8.2 2021-06-28 12:52:57 -07:00
Jordan Rose
3a3476b833 Docker: use the rust-toolchain file instead of hardcoding a version 2021-06-22 13:19:46 -07:00
Jordan Rose
b715e02aa9 Bump to version 0.8.1 2021-06-02 11:14:12 -07:00
Jordan Rose
08e72307ca Java: include the sealed sender groupId on sucessful decryption
This is useful for PlaintextContent messages (just
DecryptionErrorMessage for now), which can't include a group ID when
sent outside of sealed sender because it would reveal group
membership.
2021-05-28 10:06:31 -07:00
Jordan Rose
a095f6a1fc Bump version to 0.8.0 2021-05-27 14:32:06 -07:00
Jordan Rose
1867f75b07 Merge pull request #318 from signalapp/jrose/DecryptionErrorMessage-deviceId
Add a deviceId field to DecryptionErrorMessage
2021-05-27 14:08:06 -07:00
Jordan Rose
b54a830013 Java: put the UnidentifiedSenderMessageContent in a ProtocolException
That is, when there's an error decrypting the inner payload of a
sealed sender message, instead of just saving the sender (and more
recently the content hint and group ID), save the whole decrypted
contents of the sealed sender message. This is necessary so that the
app can make a DecryptedErrorMessage from that failed payload.

This is complicated somewhat by the fact that the app also uses the
"short" constructor for the various Protocol*Exceptions, so we have to
keep those working.
2021-05-27 12:27:48 -07:00
Jordan Rose
b780409c1b Add a deviceId field to DecryptionErrorMessage
This allows a device to know whether it's the one that sent a bad
message, and take action accordingly.

We could have a slightly more typesafe API here by using
ProtocolAddress and extracting the device ID, but that doesn't match
up with getting the device ID out of a sealed sender certificate.
2021-05-26 17:23:42 -07:00
Jordan Rose
4c0141c31f Fix merge conflict in Java and Swift tests too. 2021-05-26 16:43:11 -07:00
Jordan Rose
0f2ae6ee53 Bump version to 0.7.0 2021-05-26 16:32:06 -07:00
Jordan Rose
2491447ee7 Merge pull request #316 from signalapp/jrose/DecryptionErrorMessage-and-PlaintextContent-2
Add DecryptionErrorMessage and PlaintextContent (alternate)
2021-05-26 16:27:49 -07:00
Jordan Rose
51dd86a1db Finalize ContentHint design
- Default: sender will not resend; an error should be shown
  immediately
- Resendable: sender will try to resend; delay any error UI if
  possible
- Implicit: don't show any error UI at all; this is something sent
  implicitly like a typing message or a receipt
2021-05-26 15:57:45 -07:00
Jordan Rose
f7acf9005e Add SessionRecord.currentRatchetKeyMatches
This checks if there is an active sender state using the given ratchet
key, for use with decryption error messages. In this case, the app may
choose to archive the current session, or take even stronger actions
such as fetching new prekeys for the recipient.
2021-05-26 15:41:04 -07:00
Jordan Rose
3f3a6e1aca Expose DecryptionErrorMessage and PlaintextContent to Java/Swift/TS 2021-05-26 15:41:04 -07:00
Jordan Rose
a41233936f Bump version to 0.6.0 2021-05-21 15:04:27 -07:00
Jordan Rose
6f9083175e Get registration IDs from sessions for Sealed Sender v2
The app-visible change is that sealedSenderMultiRecipientEncrypt now
takes a SessionStore as well. Sessions will be looked up in bulk using
a new SessionStore API, 'loadExistingSessions' or
'getExistingSessions`. The registration ID is then loaded from each
session and included in the resulting SSv2 payload.

The implementation is a bit of a divergence from some other APIs in
libsignal-client in that the "look up in bulk" step is performed in
the Java, Swift, or TypeScript layer, with the resulting sessions
passed down to Rust. Why? Because otherwise we'd pass a list of
addresses into Rust, which would have to turn them back into a Java,
Swift, or TypeScript array to call the SessionStore method. This would
be (1) a bunch of extra work to implement, and (2) a waste of CPU when
we already /have/ a list of addresses in the correct format: the
argument to sealedSenderMultiRecipientEncrypt.

This is an example of "the boundaries between the Rust and
Java/Swift/TypeScript parts of the library don't have to be perfect;
they're internal to the overall product". In this case, we've taken
that a little further than usual: usually we try to make the
libsignal-protocol API as convenient as possible as well, but here it
had to be a bit lower-level to satisfy the needs of the app language
wrappers. (Specifically, callers need to fetch the list of
SessionRecords themselves.)

P.S. Why doesn't v1 of sealed sender include registration IDs? Because
for SSv1, libsignal-client isn't producing the entire request body to
upload to the server; it's only producing the message content that
will be decrypted by the recipient. With SSv2, the serialized message
the recipient downloads has both shared and per-recipient data in it,
which the server must assemble from the uploaded request. Because of
this, SSv2's encrypt API might as well produce the entire request.
2021-05-20 18:04:03 -07:00
Jordan Rose
1fd8da669b Revert "Add registration IDs to the Sealed Sender v2 upload (encrypt) format" (#303) 2021-05-17 10:03:49 -07:00
Jordan Rose
b5cddf9dbb Add registration IDs to the Sealed Sender v2 upload (encrypt) format
Registration IDs are used to detect if a device ID has been reused,
since the new device will (with high probability) use a different
randomly-generated registration ID from the old one. The server should
be able to validate this for SSv2 like it does for SSv1, though the
handling of this for SSv1 is in the various apps.
2021-05-14 15:38:31 -07:00
Jordan Rose
11d9c40cc1 Merge pull request #300 from signalapp/jrose/java-SenderKeyStore-doc-comment
Java: fix doc comment for SenderKeyStore.loadSenderKey
2021-05-11 15:56:44 -07:00
Jordan Rose
a9729bbf82 Java: fix doc comment for SenderKeyStore.loadSenderKey
The summary was out of sync with the `@return` command.
2021-05-11 14:46:16 -07:00
Jordan Rose
5ef78c0004 Merge pull request #293 from signalapp/jrose/SenderKey-message-versions
A SenderKeyMessage's version must match the SenderKeyState
2021-05-10 17:02:23 -07:00
Jordan Rose
4569e1ffaf SenderKey: Use the session version as the message version
We still encode the "current" version in the message version byte, but
the part that the receiver will check is now based on the session's
original message version rather than the "current" version in the
sender. (Note that these are the /same/ version right now, so this
change won't have any effect on the current wire format.)

This matches the behavior of SignalMessage and PreKeySignalMessage.
2021-05-07 18:24:44 -07:00
Jordan Rose
8af0ab17f2 Remove public constructors for *Message types
The parameters for these constructors cannot be chosen correctly in
isolation; messages always need to be created as part of a session.

The Node APIs have been renamed with leading underscores rather than
removed because we *did* have tests that explicitly constructed
messages just to test that they faithfully preserve information. In
this case the parameters are plausible values but not used for
anything.
2021-05-07 18:17:46 -07:00
Jordan Rose
f962e387b7 Java: allow a null info for HKDF (treated as empty)
Restores compatibility with libsignal-protocol-java.
2021-05-07 10:47:34 -07:00
Jordan Rose
73a15db929 Java: record native code size for 0.5.0 and 0.5.1 2021-04-29 10:12:56 -07:00
Jordan Rose
b5f6d50b53 Bump version to 0.5.1 2021-04-28 17:05:25 -07:00
Jordan Rose
113e849d76 Bump version to 0.5.0 2021-04-21 19:07:56 -07:00
Jordan Rose
5380131e7c Java: switch to Debian for Docker builds instead of Ubuntu
Debian has a more stable retention period for pinned dependencies (the
version of OpenJDK 8 we were using for Ubuntu is gone already!), and
it matches what the Signal-Android repository is doing.
2021-04-21 12:15:33 -07:00
Jordan Rose
7d62e674b5 Bump version to v0.4.0 across all languages 2021-04-05 13:13:09 -07:00
Jordan Rose
18463e8357 Switch to a flat (non-protobuf) encoding for SealedSender v2
We're optimizing for size overhead in this encoding, so forego the
flexibility of protobufs in favor of a flat encoding (though one that
still uses protobuf's varints). Additionally, this encoding includes
the recipients inline in the message so the client can dump it all to
server in one go.

As a side effect, this means an SSv2 message encoded for sending no
longer has the same format as one encoded for receiving when there's
only one recipient. Consequently, all the tests need to be modified to
"fan out" a multi-recipient message to several single-recipient
messages. For simplicity, the wrapper language tests only support this
operation for SSv2 messages sent to exactly one recipient.
2021-04-05 11:46:52 -07:00
Jordan Rose
06431b3745 Java: remove UnidentifiedSenderMessage class
This was only used for testing when libsignal-metadata-java was first
merged into this repo, and those tests have since been moved to the
Rust layer.
2021-04-05 11:46:52 -07:00
Jordan Rose
690dfde027 Add contentHint and groupId fields to UnidentifiedSenderMessageContent
And to the ProtocolExceptions for Java, thrown when a sealed sender
message's content fails to decrypt. (Eventually all languages will
support this.)
2021-04-05 11:46:52 -07:00
Jordan Rose
d339d5a072 Expose Sealed Sender v2 to clients
- Add a new "multi-recipient encrypt" entry point
- Add an "encrypt v1 sealed sender from UnidentifiedSenderMessage-
  Content" entry point
- Add a public constructor for UnidentifiedSenderMessageContent
- Change group_encrypt to return a CiphertextMessage instead of bytes,
  so it can be used with the above
- Java: add SenderKeyStore to SignalProtocolStore requirements
2021-04-05 11:31:27 -07:00
Jordan Rose
d0f34935b9 JNI: Handle CiphertextMessage results in bridge_fns
Unlike the other two bridges, the Java representation of a
CiphertextMessage uses an interface with implementing classes, rather
than an opaque wrapper. But bridge_fn's ResultTypeInfo can model this
too, and it simplifies things to do so.
2021-04-05 11:31:27 -07:00
Jordan Rose
8509374928 SenderKeyDistributionMessage is not a CiphertextMessage
It's a payload message, something that would go inside a SignalMessage
or PreKeySignalMessage. Drop it from all the enums, and while we're
here let's sync up the CiphertextMessageType::SenderKey case with the
sealed sender content type and the envelope content type.
2021-04-05 11:31:27 -07:00