0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-19 19:42:19 +02:00
Commit Graph

586 Commits

Author SHA1 Message Date
Alex Konradi
4c78373114
Expose libsignal-net function for CDSI via JNI
Expose the existing CDSI lookup async function to Java clients. Provide a small
library that can be easily integrated into the existing codebase.
2023-11-15 10:00:46 -05:00
akonradi-signal
3d8933ec96
Add CompletableFuture.thenApply method
Add the ability to chain futures by applying arbitrary functions. Mirrors
CompletableFuture.thenApply in the Java standard library.
2023-11-13 15:06:40 -05:00
Jordan Rose
4acd05bd5d Automatically release builds on Sonatype 2023-11-13 11:31:42 -08:00
Jordan Rose
3b6100eb1d Bump to version v0.35.0 2023-11-13 10:39:59 -08:00
Jordan Rose
9839a5be79 Always use the original SSv2 version byte, 0x22, for ReceivedMessages
The format hasn't changed, so we don't need to bump the version number
for the messages the server sends to recipients.

This is implemented in two places: the Rust side for round-trip
testing, and the Java side for what the server actually does. (Both
are implemented to avoid unnecessary copies and unfortunately the two
aren't conveniently compatible with one another, but it's a simple
implementation anyway.)
2023-11-10 09:30:39 -08:00
Jordan Rose
0c13580240 SSv2: Add receive support for excluded recipients
These are encoded as having a device ID of zero. Rust-level tests will
come with the send support, so we can do round-trip tests.
2023-11-07 16:25:22 -08:00
Jordan Rose
b618fd58e7 SSv2: Require known versions in SealedSenderV2SentMessage::parse
And if we're not trying to be open to future versions, we can validate
that there's enough bytes for the ephemeral public key as well.
2023-11-07 16:25:22 -08:00
Jordan Rose
418886c599 SSv2: Add server receive support for compact device lists
This takes advantage of the fact that multiple devices for the same
user will have the same identity key and therefore will use the same
per-recipient SSv2 data anyway.

This commit also enforces (on the server side) that device IDs are in
the range 1..=127 for destinations of a SSv2 message; previously they
were varint-encoded.

When send support is added, the round-trip Rust tests will
automatically start testing this as well.
2023-11-07 16:25:22 -08:00
Jordan Rose
64d5996825 Expose SSv2 message parsing in libsignal-server 2023-11-07 12:19:14 -08:00
Jordan Rose
90e23336e0 java: Improve Pair's equals, hashCode, and toString 2023-11-06 12:19:56 -08:00
Max Moiseev
611deac10d Bump to version 0.34.0 2023-11-03 11:46:38 -07:00
Jordan Rose
d768f47020 usernames: Allow generating a new link buffer with existing entropy
This allows updating the encrypted username associated with a link
without rotating the link itself.
2023-11-02 15:02:36 -07:00
Jordan Rose
44261bb623 Use the 64-bit curve25519-dalek backend even on 32-bit Android 2023-11-01 10:11:30 -07:00
Jordan Rose
37c7b482ca Bump to version v0.33.0 2023-10-26 14:03:22 -07:00
Jordan Rose
3ac14b17a7 Fix Android tests for 9c79bc97c 2023-10-26 13:25:43 -07:00
Jessa
7af14c6b06
Add WebP sanitizer
This adds integration bits for the new webpsan, a WebP image sanitizer -- which
currently simply checks the validity of a WebP file input, so that passing a
malformed file to an unsafe parser can be avoided. The integration pretty much
just leverages the integration work that was already done for mp4san.
2023-10-26 15:16:59 -04:00
ravi-signal
9c79bc97cb
zkgroup: move java BackupAuthTest to server lib
This test does base64 decoding which differs between android 21 and
non-android platforms.
2023-10-26 13:15:25 -05:00
ravi-signal
790db2383e
zkgroup: add backup auth credential
Allows a client to request a credential for a backup-id without
revealing the backup-id to the issuing server. Later, the client may use
this to make requests for the backup-id without identifying themselves
to the server.
2023-10-25 17:26:58 -05:00
Jordan Rose
55a1958a15 Test various error and panic scenarios for bridge_fn and bridge_io 2023-10-12 12:23:22 -07:00
Jordan Rose
63efc8bf4d bridge_io: Add an explicit parameter for the async runtime
This will let us (a) avoid hardcoding any particular async runtime in
the libsignal-bridge macros, and (b) separate the platform-specific
stuff from the async runtime. libsignal_bridge now has an AsyncRuntime
trait whose only requirement is "run a self-contained Future".
2023-10-05 09:37:55 -07:00
Jordan Rose
e8c82fe4b7 build_jni.sh: Allow building just one Android slice at a time 2023-10-04 16:02:45 -07:00
Jordan Rose
ae47f039fa bridge: Add a bridge_io macro that expects a runtime
For now, the "runtime" is spawning a thread that then uses
now_or_never, but eventually this will be a persistent tokio runtime
of some kind.

Also for now, this is only implemented for Java. Swift and Node
support coming soon.
2023-10-02 14:08:10 -07:00
Jordan Rose
5fde77a631 Don't include the Future testing APIs when building for Android 2023-09-27 06:48:21 -07:00
Jordan Rose
a15fffd058 Java: Teach gen_java_decl about Futures for type-safety. 2023-09-27 06:48:21 -07:00
Jordan Rose
2c295f68c9 Java: Implement completing Java Futures from Rust 2023-09-27 06:48:21 -07:00
Jordan Rose
dab8a18959 Java: Add a StderrLogger for testing 2023-09-27 06:48:21 -07:00
Jordan Rose
a563c9b93d Java: Add a bare-bones Future implementation for upcoming async APIs 2023-09-27 06:48:21 -07:00
moiseev-signal
840a1906c7
Update prost to version 0.12 2023-09-20 14:00:54 -07:00
Alex Konradi
d1f9dff273 Bump to version v0.32.1 2023-09-20 14:26:31 -04:00
moiseev-signal
36363750a2
Reimplement IncrementalMacInputStream backed by directly allocated ByteBuffer 2023-09-15 11:00:50 -07:00
Max Moiseev
72f046fe19 Bump to version v0.32.0 2023-09-01 13:43:06 -07:00
moiseev-signal
9d1ab7811e
java: Do not close the inner stream in IncrementalMacOutputStream 2023-09-01 13:02:17 -07:00
moiseev-signal
e26381aa3c
java: Implement readBuffer missing from older Androids 2023-08-31 17:34:44 -07:00
moiseev-signal
6abe26a0c1
Improve incremental MAC API 2023-08-31 15:28:39 -07:00
Jordan Rose
3810154436 Automate the Android and Server publishing to Sonatype 2023-08-25 12:33:56 -07:00
Jordan Rose
9aad792fc6
Update all the RustCrypto crates 2023-08-25 11:28:49 -07:00
Jordan Rose
e11a825fe3 Gradle: Adopt Nexus plugin to automatically close releases on Sonatype 2023-08-24 12:21:25 -07:00
Jordan Rose
b27f5c0f2e Gradle: Set version and group info in the root project
This will be necessary to adopt the Gradle Nexus publishing plugin,
but it's also just simpler.
2023-08-24 12:21:25 -07:00
Jordan Rose
024c618f20 protocol: Throw SessionNotFound for an expired unacknowledged session
For the most part this should happen transparently without any
explicit adoption, like the previous change, but for Java code the
NoSessionException is now properly declared on SessionCipher.encrypt.
(This was always technically possible, but clients were expected to
have previously checked for session validity before using
SessionCipher; now that there's an expiration involved, that's not
strictly possible.)
2023-08-22 17:00:35 -07:00
Jordan Rose
a04c4f27a6 protocol: Check expiration in hasSenderChain/hasCurrentState
And consolidate the implementations of these two separate checks; now
they both check for a valid session by looking for a sender chain
instead of just *some* current session, in addition to the new check
for an expired unacknowledged session. At the Rust level, this is now
one check named has_usable_sender_chain; at the app levels, the old
names of hasSenderChain (Java) and hasCurrentState (Swift, TypeScript)
have been preserved.

Tests to come in the next commit.
2023-08-22 17:00:35 -07:00
Jordan Rose
9ca91fe2c0 protocol: Record the timestamp when a pre-key bundle is processed 2023-08-22 17:00:35 -07:00
Jordan Rose
02e1c45fed protocol: Remove SessionRecord.fromSingleSessionState
This was only used to migrate from an old Android session format
(pre-2018)...and it's been broken for years on the Android side. Just
remove it.
2023-08-22 10:26:46 -07:00
moiseev-signal
f9471c9c68
Set up and apply code formatting for Java 2023-08-22 09:15:23 -07:00
Sebastian
81a8360606 Add Automatic-Module-Name attribute to jar manifest
This allows using the libraries from java modules.

https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_modular_auto
2023-08-15 18:08:00 -07:00
moiseev-signal
1e9492ef60
java: Piggyback on base.clean Gradle task 2023-08-14 15:22:57 -07:00
moiseev-signal
62853d7d99
Address javadoc warnings 2023-08-10 15:13:32 -07:00
Max Moiseev
32f53a7894 Bump to version v0.31.0 2023-08-09 15:26:47 -07:00
moiseev-signal
716e683324
Update dependencies following curve25519-dalek 4.0.0 release
Co-authored-by: Jordan Rose <jrose@signal.org>
2023-08-09 15:04:41 -07:00
Jordan Rose
24f6c6bc20 Bump to version v0.30.2 2023-08-03 10:50:59 -07:00
Jordan Rose
ff81905fc6 Add senderAci() to SenderCertificate and DecryptionResult
Like ProtocolAddresses in 88a2d5c, these APIs will eventually only
support ACIs, so introducing strong types now helps move in that
direction. However, the existing APIs that produce strings have not
been removed yet.
2023-08-02 17:51:23 -07:00
Jordan Rose
45fb135880 Add {Aci,Pni}.parseFromServiceId{String,Binary}
These work the same as the equivalent factory methods on ServiceId,
but throw if the resulting parsed ServiceId doesn't match the specific
type you were trying to parse.
2023-08-02 17:51:23 -07:00
moiseev-signal
2938b65ffa java: Prefer checked exceptions for ServiceId parsing methods 2023-07-27 15:40:44 -07:00
Jordan Rose
761c8080ee java: Reorganize tests 2023-07-27 15:40:44 -07:00
Jordan Rose
008fad966e protocol: Rip "Context" out of the Rust layer
Only the iOS client ever used this extra parameter, and it's one
that's easily stored alongside the reference to a store. This is
massively simpler than having it threaded down to the Rust
libsignal_protocol and back up through the bridging layer.
2023-07-27 15:40:44 -07:00
Jordan Rose
dea887e94c Bump to version v0.30.1 2023-07-27 15:40:01 -07:00
Jordan Rose
3b7f3173cc Bump to version v0.30.0 2023-07-20 14:02:10 -07:00
Jordan Rose
231aa16510 Give AuthCredentialWithPni "PniAsServiceId" and "PniAsAci" variants
The former is what we want going forward; the latter is equivalent to
the old format for compatibility with previous client builds.
2023-07-20 12:28:19 -07:00
Jordan Rose
6a547bf3f2 zkgroup: Use ServiceId and Aci in public APIs instead of UidBytes
Some of these APIs have to match up with UuidCiphertexts, and so we
convert them all for consistency.
2023-07-20 12:26:46 -07:00
Jordan Rose
af34c38c03 zkgroup: Convert UuidCiphertext operations to use ServiceId
Eventually all of zkgroup will use ServiceId, but this part will
actually behave differently.
2023-07-20 12:23:10 -07:00
Sergey Skrobotov
28fea98c1b Bump to version v0.29.0 2023-07-19 18:24:46 -07:00
Jordan Rose
bc19fb33df
java: Use our own mirror to reproducibly build for Android and Server
Co-authored-by: Greyson Parrelli <greyson@signal.org>
2023-07-19 15:51:07 -07:00
Jordan Rose
88a2d5c740 Add convenience APIs to ProtocolAddress for using ServiceIds
In a future release ProtocolAddresses will *only* support ServiceIds,
so these APIs are designed to be the nullable version of the signature
they'll eventually have. Since ProtocolAddresses are created by the
client app in nearly all cases, they should be able to ignore the null
case if they only use ServiceIds in their input.
2023-07-19 14:12:05 -07:00
Jordan Rose
86b2fcc427 Bump to version v0.28.1 2023-07-14 13:45:10 -07:00
Jordan Rose
e32cd70358 java: Override 'hashCode' in ServiceId to go with 'equals' 2023-07-14 13:36:25 -07:00
Sergey Skrobotov
68f851e1ca Bump to version v0.28.0 2023-07-13 17:26:49 -07:00
Jordan Rose
6800244a53
protocol: Add the ServiceId, Aci, and Pni types
Co-authored-by: Max Moiseev <moiseev@signal.org>
2023-07-13 13:54:53 -07:00
Sergey Skrobotov
ca262db5ec bridge for username links 2023-07-06 15:51:52 -07:00
moiseev-signal
7d37b1c2f8
Better handle incremental mac edge case 2023-06-28 10:56:25 -07:00
Jordan Rose
af7bb8567c Bump to version v0.27.0 2023-06-09 11:49:48 -07:00
moiseev-signal
19d9e9f0f4
node: Add PQXDH support 2023-06-02 10:42:39 -07:00
Jordan Rose
8abeeeb4ef Bump to version v0.26.0 2023-05-31 13:58:46 -07:00
Jordan Rose
d61cc8f13e java: Include a ProtocolAddress in NoSessionException
This is a minimal change to not lose information that we already have
in Rust; there may be further changes in the future (such as avoiding
the redundancy now in ProtocolNoSessionException, or splitting out
missing Sender Key sessions, which don't have an address, from missing
Double Ratchet sessions).
2023-05-31 10:34:55 -07:00
moiseev-signal
dda3e0f71a
Update Java tests with PQXDH cases 2023-05-30 14:56:04 -07:00
ravi-signal
803e7fe752
pin: move svr2 pin hash out of Svr2Client
- moves svr2 pin hashing to a standalone function
- take string instead of utf-8 encoded bytes where possible
2023-05-30 11:24:54 -05:00
Jonathan Klabunde Tomer
c0a8e34aef add missing throws declarations on KEM*Key constructors 2023-05-23 17:25:18 -07:00
Max Moiseev
b0a1bf2bd6 Make javac treat sources as UTF-8 2023-05-17 17:00:13 -07:00
Ravi Khadiwala
a196fb8ecd Bump to version v0.25.0 2023-05-17 13:31:29 -05:00
Ravi Khadiwala
1a1e8e0285 attest: mark svr2 apis ready for use 2023-05-12 12:17:43 -05:00
Ravi Khadiwala
c70f19d294 attest: update svr2 constants 2023-05-12 12:17:43 -05:00
Max Moiseev
0e2f87f39a Bump to version v0.24.0 2023-05-09 17:19:28 -07:00
Rolfe Schmidt
ff09619432 Add Kyber KEM and implement PQXDH protocol
Co-authored-by: Jordan Rose <jrose@signal.org>
Co-authored-by: Max Moiseev <moiseev@signal.org>
2023-05-09 16:44:40 -07:00
moiseev-signal
2b46ae1e85
Implement incremental MAC 2023-05-09 12:29:25 -07:00
Jordan Rose
0e74a41eb9 bridge: Put signal-media behind a feature flag, off for iOS by default
The JNI tests have also been conditionalized in case we want to take
this out for Android as well. (Node still unconditionally depends on
it being present.) I've given it a separate feature flag from just
ffi/jni/node so that we can preserve the tests Jessa wrote for each
platform.
2023-05-09 11:02:31 -07:00
Jordan Rose
a27fc0c557 java: Allow Unicode characters in javadocs 2023-05-01 12:01:08 -07:00
Jessa
9eb3483938 Add MP4 format sanitizer
This MP4 format "sanitizer" currently only transforms (when necessary) outgoing media on iOS, Android, or Desktop to
make it suitable for streaming playback by the recepient. In the future, it will validate and be able to either repair
or reject outbound AND inbound media, to prevent malformed media from being fed to third party or OS media players.

An generic io module was added to the libsignal rust bridge containing the InputStream trait, modeled loosely after
Java's InputStream, which calls back into the client language to perform reads or skips. This infrastructure could
potentially also be for any other future large data inputs to libsignal functions.
2023-05-01 12:01:08 -07:00
Jordan Rose
d3e38b9e5c Bump version to v0.23.0 2023-05-01 12:01:08 -07:00
Jordan Rose
c433d1e34c Expose ProfileKey.deriveAccessKey()
Client apps will be able to switch over to this at their leisure.
2023-04-25 18:42:51 -07:00
Jordan Rose
e588fa5450
zkgroup: Add CallLinkAuthCredential
This is very similar to the AuthCredential used by the group server,
but using CallLinkParams to encrypt the user ID rather than
GroupParams (and using GenericServerParams to issue the credential
rather than the group server's ServerParams).
2023-04-25 17:18:05 -07:00
Jordan Rose
1b5449e777
zkgroup: Add a "Create Call Link" credential
This will allow a user to request to create a call link from the chat
server without revealing anything about the room, and then later
actually create it by giving the room ID to the calling server without
identifying themself.

This involves a new, stripped-down GenericServer{Secret,Public}Params,
which currently only contains a generic "zkcredential" key. Apart from
the calling server not needing to handle all the credentials that the
group storage server supports, the structure of zkcredential means it
is safe to use the same key for multiple kinds of credentials. 
Similarly, CallLink{Secret,Public}Params plays the same role as
Group{Secret,Public}Params for encrypting user IDs when talking to the
calling server.

Following from that, the APIs for CreateCallLinkCredentials are
located on the individual types (RequestContext, Request, Response,
Credential, Presentation) rather than all being on the Server*Params
types; adding a new credential type won't change the API of the
Server*Params types at all.

The main Server*Params may make use of zkcredential in the future as
well, but for now it's only for new Signal servers that want to use
zero-knowledge credentials.
2023-04-25 16:53:42 -07:00
Jonathan Klabunde Tomer
1712d708e7 declare checked exceptions thrown by EC*Key methods 2023-04-24 13:43:49 -07:00
Jordan Rose
4175751cbe Remove the non-expiring ProfileKeyCredential
Keep support for deserializing ProfileKeyCredentialPresentationV2
because that may be in some group history.
2023-04-18 17:47:49 -07:00
Jordan Rose
bf984c7b54 Remove deprecated PniCredential 2023-04-18 17:47:49 -07:00
Jordan Rose
64f0b5e782 java: Allow building only for desktop+server with -PskipAndroid 2023-04-18 14:25:38 -07:00
Ravi Khadiwala
1f8c279622 pin: Add pin hashing and an svr2 client
- Add a new SGX client that can be used for testing svr2
- Add pin hashing that can be used with svr1 and svr2
2023-03-29 13:59:28 -05:00
Max Moiseev
0bd497d5e8 Make tests more deterministic 2023-02-13 11:06:49 -08:00
Max Moiseev
58ebf5f06d Bump NDK version to match the Github runner update 2023-02-13 10:03:45 -08:00
Max Moiseev
39293fa906 Bump to version v0.22.2 2023-02-10 12:07:18 -08:00
Max Moiseev
90c02f3b69 Bump to version v0.22.1 2023-02-09 11:45:09 -08:00
Max Moiseev
f1b6c63e34 Make Java API for username hashing more idiomatic 2023-02-09 11:18:24 -08:00
Max Moiseev
c98ed9cb6d Bump to version v0.22.0 2023-02-03 17:57:44 -08:00
Max Moiseev
33d8421ca9 Bridge username hashing APIs to all client platforms 2023-02-03 17:44:29 -08:00
Jordan Rose
5b3d8bb731 Remove Android 19 support 2023-01-26 12:59:06 -08:00
Jordan Rose
3c5f00fffe java: Fix host build / server testing on Windows
- We weren't loading the native library as "signal_jni.dll"
- The Gradle build commands, though still requiring a shell environment,
  shouldn't rely on Unix-style #! lines to execute shell scripts
2022-12-05 11:42:06 -08:00
Jordan Rose
bce62c7bfd Android: Build on platforms other than Linux
Right now the Android SDK never contains more than one prebuilt
toolchain, so we can glob to find the one that's installed.
2022-12-05 10:02:54 -08:00
Jordan Rose
b8ac70227d Android: no need to set ANDROID_NDK_HOME when using Gradle
The Android Gradle plugin already allows you to specify which NDK to
use; we should let the plugin find it for us.
2022-12-05 10:02:54 -08:00
Jordan Rose
98fd87ee9b Android: Add very basic Curve25519 benchmarks 2022-12-02 17:14:06 -08:00
Jordan Rose
572ba1e38b Update Rust to nightly-2022-11-03, and the Android NDK to r25b
These are intertwined: older versions of Rust don't support the newer
NDK, but the newer Rust can't successfully compile BoringSSL against
the older NDK.

This requires a boring-sys update to find the Android NDK sysroot in
the right place.
2022-12-01 12:23:57 -08:00
Jordan Rose
dd0315ad26 Bump to version v0.21.1 2022-10-20 13:04:57 -07:00
Sebastian
ad1fabbbf2 Change getSender method of SenderCertificate to always return UUID
Currently the only user of this method is the ProtcolException constructor,
when a UnidentifiedSenderMessageContent is present.
All other instances of ProtocolException use the sender's UUID as sender.
So it would be good to have this consistent.

Also brings this in line with similar methods, like `getSourceIdentifier` on
SignalServiceEnvelope.
2022-10-17 12:13:53 -07:00
Jordan Rose
d94f1b3d70 Bump version to v0.21.0 2022-10-14 13:53:57 -07:00
Jordan Rose
26e7fa5559
zkgroup: Remove v1 presentations
Removes AuthCredentialPresentationV1 and PniCredentialPresentationV1
entirely. For ProfileKeyCredentialPresentationV1, there are still
situations where we want to extract the UUID and profile key, so we
continue to support parsing only.
2022-10-13 15:46:36 -07:00
Jordan Rose
d270e06127 Docker: Use -it and --init to handle SIGTERM (^C) properly
-i (interactive) and -t (allocate a tty) allow the shell running
inside Docker to handle Ctrl-C (^C) and other shell commands, so you
can stop a command in the interactive process you ran it. However,
they only work if the containing shell (the one where you ran `docker
run`) is also interactive with a tty hooked up, so we test for that
first in both scripts that invoke `docker run`, using `test -t`.

--init passes signals from *outside* Docker down to its subprocesses,
so that cancellation from *another* context works for our Docker
images. This includes the Cancel button in GitHub Actions.
2022-08-23 13:31:30 -07:00
Jordan Rose
ab29fed4db Bump version to v0.20.0 2022-08-22 15:21:40 -07:00
Jordan Rose
f2f6188593 Android: fix connectedAndroidTests
- Include the same resources that the 'client' project uses
- Desugar newer JDK APIs so we can test on the oldest devices (KitKat)
2022-08-22 12:16:47 -07:00
Jordan Rose
e8d73665b4 zkgroup: Move AuthCredential redemption time checking down to Rust
This was previously in the Java layer because it only really affects
the server, but it's more consistent to have all verification in the
Rust layer. We do lose the separate exception type for it, though.
2022-08-09 13:47:17 -07:00
Jordan Rose
13b60197a9 Bump version to v0.19.3 2022-08-04 11:04:31 -07:00
Ravi Khadiwala
93cdd47a30 cds2: add jni binding for attestation metrics
Adds a java method for libsignal-server that enables extracting
attestation metrics from serialized evidence and endorsements.
Certificate and endorsement validity periods are exposed, so servers
can track if any attestation material is overly stale.
2022-08-04 10:26:47 -07:00
Jordan Rose
3c365ab1da Bump to version v0.19.2 2022-08-01 16:04:37 -07:00
Jordan Rose
2f07edaa02 Bump to version v0.19.1 2022-07-25 17:13:19 -07:00
Jordan Rose
f456227f17 Java: drop cargo-ndk for building for Android
We can provide the necessary information in environment variables and
save a host dependency.
2022-07-25 17:11:36 -07:00
Jordan Rose
cd40df36e7 Update Dockerfile for the reproducible Java/Android build
- Use the headless variant of the JDK.
- Put most apt-get requirements at the end of the file, so that
  tweaking them can make use of Docker's per-RUN line caching.
- Added 'clang' as a build dependency for BoringSSL.
- Drop unnecessary packages:
  - apt-transport-https - we're using plain http sources at this time
  - build-essential - overkill, we just need 'make'
  - gcc-multilib - was used to build OpenSSL for testing,
    no longer necessary with the switch to BoringSSL
  - openssh-client - was used to clone from GitHub, now unused because
    all dependencies are public

And note that the "slow tests" should also be passing before a
release.
2022-07-25 16:36:36 -07:00
Jordan Rose
c02cb26018 Bump version to 0.19.0 2022-07-22 15:36:22 -07:00
Chris Eager
8035a70509
[feature] CDS2 attestation
Implements (a subset of) Intel's DCAP attestation,
making heavy use of 'boring' for X509 and ECDSA.
Cds2Client is now ready for use!

Co-authored-by: Jordan Rose <jrose@signal.org>
Co-authored-by: Ravi Khadiwala <ravi@signal.org>
2022-07-22 12:23:57 -07:00
Jordan Rose
e54685b281 Bump to version v0.18.1 2022-06-29 12:01:17 -07:00
Jordan Rose
e6f149c93d zkgroup: Deprecate PniCredential operations
...but not the types at this time, because that produces extra
warnings that need silencing.
2022-06-28 17:21:41 -07:00
Jordan Rose
8135419d30 Java: Lint for deprecation, fallthroughs, and unchecked generics
And disable the deprecation lint for overriding 'finalize', which we
use for bridged object management.
2022-06-28 17:21:41 -07:00
Jordan Rose
366b030841 Re-apply "device transfer: replace picky with boring"
This reverts commit 09c043c54a.
2022-06-22 16:33:21 -07:00
Jordan Rose
2a46a5b294 Update code size for the *real* v0.18.0 2022-06-22 15:58:44 -07:00
Jordan Rose
09c043c54a Revert "device transfer: replace picky with boring"
We need to work out more kinks cross-compiling boring-sys, so revert
this for now. (But keep the fix to use the correct Android NDK.)
2022-06-22 15:56:21 -07:00
Jordan Rose
bee544ec73 Bump version to v0.18.0 2022-06-21 15:58:48 -07:00
Jordan Rose
70ec1ca26f
zkgroup: Add AuthCredentialWithPni
This is a variant of AuthCredential that carries two UUIDs, intended
to be a user's ACI and PNI. Why? Because when you've been invited to a
group, you may have been invited by your ACI or by your PNI, or by
both, and it's easier for clients to treat all those states the same
by having a credential that covers both identities. The downside is
that it's larger (both the data, obviously, but also the zkgroup proof
of validity, unsurprisingly).

AnyAuthCredentialPresentation gains a 'get_pni_ciphertext' method,
which will return `None` for the existing presentations and
`Some(encrypted_pni)` for the new credential. Having a separate
credential type but a common presentation type makes it easier for the
server to handle all possible credentials uniformly.
2022-06-21 15:11:57 -07:00
Jordan Rose
cc217911a9 zkgroup: Remove C_z from ExpiringProfileKeyCredentialPresentationProof
This term is unnecessary after all (the value of 'z' is already fixed
by the equation "Z = I^z"). We can't remove it from earlier proofs
because that would change the format, but going forward we don't need
it.
2022-06-17 17:12:05 -07:00
Jordan Rose
395e36e9f2
zkgroup: Add ExpiringProfileKeyCredential
Like ProfileKeyCredential, but with an expiration timestamp embedded
in it. This has its own credential type and response type, but uses
the same request type as a "classic" ProfileKeyCredential, and
generates presentations usable with AnyProfileKeyCredential-
Presentation, so that existing server code accepting presentations
will automatically do the right thing.

Adoption for servers:

- Update secret params
- When presentations are saved in group state, use 
  ProfileKeyCredentialPresentation.getStructurallyValidV1PresentationBytes()
  to maintain backwards compatibility with existing clients.
- Add an endpoint to issue ExpiringProfileKeyCredentials
- (future) Remove the endpoint that issues regular ProfileKeyCredentials

Adoption for clients, after the server has updated:

- Update public params
- Start fetching and using ExpiringProfileKeyCredentials instead of 
  regular ProfileKeyCredentials (the old endpoint will eventually
  go away)
- Node: To bring types into harmony, a receipt's expiration time has
  been changed to a `number` instead of a `bigint`
2022-06-17 13:10:10 -07:00
Jordan Rose
d404b3cec5 Build boring-sys with OPENSSL_SMALL for both iOS and Android
This trades speed for size around certain elliptic curve operations in
BoringSSL. We're using boring mostly for verifying certificates, not
the many many curve operations we do on a per-message basis, so for
now the code size is more important.
2022-06-17 11:28:10 -07:00
Chris Eager
2b0b5119f2
device transfer: replace picky with boring
Upcoming work in `attest` requires additional X509 support, and swapping these libraries 
is a negligible impact on binary size. This uses a fork of `cloudflare/boring`, as
we have some additions that haven’t yet been contributed upstream.
2022-06-16 13:14:17 -07:00
Jordan Rose
f1825c4892 Revert "Expose SessionRecord.needsPniSignature/.setNeedsPniSignature"
This reverts commit 71fdd6566e.
2022-05-25 10:38:32 -07:00
Chris Eager
2c32fb802d Bump version to v0.17.0 2022-05-13 14:30:30 -07:00
Chris Eager
7e734dd5b4
CDS2: add initial, not-for-production, client bindings 2022-05-13 13:39:26 -07:00
Chris Eager
80f8a2dac2 Add sha256 to reproducible java/Dockerfile 2022-04-29 16:27:30 -07:00
Jordan Rose
916269c3e5 Bump to version v0.16.0 2022-04-06 11:08:56 -07:00
Trevor Perrin
7e12a71889
zkgroup: Optimize credential presentation and FFI cleanup
Optimize presentation of credentials (AuthCredentialPresentationV2, ProfileKeyCredentialPresentationV2, PniCredentialPresentationV2). Server will accept V1 or V2 presentations. Clients will produce V2.

Various improvements to FFI to support this, and some minor optimizations (in particular "lazy statics" to avoid redundant loading of SystemParams).
2022-04-06 11:07:08 -07:00
Jordan Rose
300b57fa9e Java: Add a ProGuard file to preserve our JNI bindings 2022-03-29 17:08:48 -07:00
Jordan Rose
48ce4bf27d java: Test devicetransfer with java.security.cert.CertificateFactory
...instead of the deprecated javax.security.cert.X509Certificate.
2022-03-28 09:49:31 -07:00
Jordan Rose
8247be4840 Java: Fix package for InvalidSenderKeySessionException 2022-03-25 15:34:30 -07:00
Jordan Rose
ba47c9d681 Bump to version v0.15.1 2022-03-24 17:01:23 -07:00
Jordan Rose
355e2006c4 Java: update reproducible build to Debian Buster (from Stretch)
The main advantage here is that we don't need any dependencies from
the unstable repo, which means we can be sure that the glibc version
we build against is suitable for Buster instead of being pulled in
from a later train. (We can't do this for Stretch because Stretch is
too old for all our build tools.)

While here, simplify the build a little bit: we're already using
snapshots of the Debian repo, so drop the separate file for pinned
dependencies.
2022-03-24 16:59:36 -07:00
Jordan Rose
b5d48df116 Bump to version v0.15.0 2022-03-23 10:57:54 -07:00
Jordan Rose
0542686e70 Update artifact/package/module names across all three app languages
- Java: org.whispersystems:signal-client-java ->
    org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
    org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
    org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
    github.com/signalapp/libsignal
2022-03-23 10:49:09 -07:00
Jordan Rose
a0c1745f8b Java: reorganize package structure
- org.whispersystems.libsignal -> org.signal.libsignal.protocol
- org.whispersystems.libsignal.protocol ->
    org.signal.libsignal.protocol.messages
- org.whispersystems.libsignal.util.AndroidSignalProtocolLogger ->
    org.signal.libsignal.logging.AndroidSignalProtocolLogger
- org.signal.zkgroup -> org.signal.libsignal.zkgroup
- org.signal.devicetransfer -> org.signal.libsignal.devicetransfer
  (test only)
- org.signal.client.internal -> org.signal.libsignal.internal
2022-03-23 10:49:09 -07:00
Jordan Rose
f98b7394ec Gradle: Conditionally throw an error when building without JDK 11
Previously the project would error out during the configuration stage,
since the Android Gradle plugin requires JDK 11 to even load. Now it
throws an error if you try to build a top-level task or a task in the
Android subproject, but allows you to build, e.g. 'client:test' with
no problems.
2022-03-22 10:19:47 -07:00
Jordan Rose
526cbab04f Gradle: Fix conditional execution of :downloadNonLinuxLibraries
This helper task was supposed to only execute when publishing the
client or server artifacts, but at the point where that was checked
the task graph *hasn't been built yet*. Instead, add the task to the
task graph unconditionally, but disable it by default, and have its
dependents enable it only when publishing.
2022-03-22 10:19:47 -07:00
Jordan Rose
4e10836255 Java: fix directory structure for org.signal.libsignal.metadata 2022-03-22 10:19:47 -07:00
Jordan Rose
d26cf8b46d Add dedicated error types for invalid 1:1 and Sender Key sessions
In Java these are subclasses of IllegalStateException, a
RuntimeException, so that every session operation isn't annotated as
throwing InvalidSessionException. Swift and TypeScript don't have
typed errors, so they're just additional specific cases that can be
caught.
2022-03-21 14:12:04 -07:00
Jordan Rose
c22f7c76b9 java: Fix exception specifications
Some were overzealous, others were missing. Some are still not really
appropriate; see further commits.
2022-03-21 14:12:04 -07:00
Jordan Rose
556f658f1f java: Avoid some unnecessary serialization just to deserialize again 2022-03-18 11:34:17 -07:00
Jordan Rose
0f5744a712 protocol: Remove the ability to create an empty SenderKeyRecord 2022-03-16 14:09:08 -07:00
Jordan Rose
2cefe2afd6 NoSenderKeyState is a kind of NoSession / SessionNotFound error
...not an illegal state. Also, put the distribution ID in here too,
for good measure.
2022-03-16 14:09:08 -07:00
Jordan Rose
bd30563044 Java: use the artifact name as the human-readable name when publishing
This matches the (explicitly-specified) name in the previous Gradle
configuration.
2022-03-11 13:31:13 -08:00
Jordan Rose
d2dd1edd78 Java: fix Makefile publish action 2022-03-11 13:31:13 -08:00
Jordan Rose
6787408e5d Bump to version v0.14.0 2022-03-11 11:00:16 -08:00
Jordan Rose
57c1de6463 Treat InvalidMacKeyLength as InvalidKeyException
...not a generic RuntimeException. Now that it's only used for
SignalMessage MAC keys, the only way it could be wrong is if it's
provided incorrectly by the user.
2022-03-10 16:21:13 -08:00
Jordan Rose
43054913ed Java: Always include Mac and Windows support when publishing
Rather than have a separate "testable" artifact, always include Mac
and Windows versions of libsignal_jni.so when publishing
signal-client-java *and* libsignal_server (though not when just
building locally).

Also, finally attach these tasks to the correct step (processResources
rather than compileJava).
2022-03-10 13:36:26 -08:00
Jordan Rose
821d72d65a Java: add back missing repository information
I deleted this for simplicity when updating to Gradle 7.4 and then
forgot to put it back.
2022-03-10 13:36:26 -08:00
Jordan Rose
08b2d38b84 Java: Replace local copy of Guava's Optional with java.util.Optional
And remove all other local copies of Guava classes (Function,
Preconditions, Supplier in addition to Optional/Absent/Present).
2022-03-10 10:34:15 -08:00
Jordan Rose
7931bf0812 java: Build a separate libsignal-server artifact
Reorganize the Gradle build with three targets:

- signal-client-java (client/)
- signal-client-android (android/)
- libsignal-server (server/)

plus an additional shared/ directory for sources shared between
client/ and server/.

This maintains the distinction between signal-client-java (the Java
parts, plus a Linux libsignal_jni.so for running tests outside of the
Android emulator) and signal-client-android (contains the Android JNI
libraries, plus any Android-specific code, which for now is just
AndroidSignalProtocolLogger, which the app doesn't even use).

The new libsignal-server is built very similarly to
signal-client-java, but only contains the Java sources relevant for
the server...plus the base org.whispersystems.libsignal classes from
the original libsignal-protocol-java, because some of them are
referenced directly in our generated Native.java. (We can improve on
this in the future.) The "testable" artifact that includes macOS and
Windows versions of libsignal_jni.so is now only built for
libsignal-server, not signal-client-java; our Android development
happens on Linux, but server development happens on multiple
platforms.

Tests were recently reorganized into a top-level tests/ directory, but
now there's been another reorganization:

- client/src/test/ - tests to run on any clients
- android/src/androidTest/ - tests to run only on Android devices /
  emulators (currently none)
- server/src/test/ - tests to run specifically for the server
  (currently none)
- shared/test/ - does not exist to avoid running the same tests twice

There are no tests to run "only not on Android devices", and it's
currently assumed that all server functionality is tested by the
client tests. The Android device tests run all the client tests as
well (by direct path reference). This may not be the "best" Gradle
layout, but it's at least straightforward to read the Gradle files.

For now there's still only one native library built for both
signal-client-java and libsignal-server, but that could change in the
future.
2022-03-10 09:14:55 -08:00
Jordan Rose
0b9dffdd88 Java: Update to Gradle 7.4, and several other build system updates
- Switch to the modern maven-publish plugin.

- Bump the Android target SDK version to 30 to match the app.
  (The minimum is still 19.)

- Bump the Java source compatibility version to 1.8.

- Bump the Android command line tools used in Docker to match the app.

- Bump the JDK used in Docker to OpenJDK 11, matching the app.

- Switch to the androidx testing libraries for emulator testing.

- Drop unused trove4j Gradle plugin.

- Lots of cleanup and refactoring.
2022-03-07 16:51:19 -08:00
Jordan Rose
246c4e4fb9 java: Remove "tests" Gradle module
The Java and Android targets are set up to both run common tests in
the top-level tests/ directory, which will be useful if we ever want
tests that only run in the Android emulator, or do *not* run in the
Android emulator. However, that top-level folder doesn't need to be a
Gradle module itself.
2022-03-07 16:51:19 -08:00
Jordan Rose
613338d54a Bump version to v0.13.0 2022-02-18 15:45:31 -08:00
Jordan Rose
4bd3778e69 Bump to version v0.12.4 2022-02-10 10:47:45 -08:00
Jordan Rose
e2f4c4542e Bump to version v0.12.3 2022-02-09 11:34:44 -08:00
Jordan Rose
3477c38d93
Merge pull request #444 from signalapp/greyson/decryption-result
Added message type to sealed sender decryption result.
2022-02-09 10:34:55 -08:00
Greyson Parrelli
2560f7d652 Added message type to sealed sender decryption result. 2022-02-09 13:02:59 -05:00
Jordan Rose
71dac29e42 Bump to version v0.12.2 2022-01-31 18:02:49 -08:00
Jordan Rose
3c5c312e45 Bump to version v0.12.1 2022-01-27 14:37:36 -08:00
Jordan Rose
e33ce03213 java: Add PlaintextContent(byte[]) constructor
This is necessary when handling PlaintextContent *not* sent via sealed
sender.
2022-01-27 14:13:25 -08:00
Jordan Rose
3da7078ffe Bump to version v0.12.0 2021-12-20 11:21:02 -08:00
Jordan Rose
600b9070c1
Merge pull request #435 from signalapp/jrose/signAlternateIdentity
Add signAlternateIdentity and verifyAlternateIdentity operations
2021-12-20 11:06:54 -08:00
Jordan Rose
66c65cda86 Expose signAlternateIdentity and verifyAlternateIdentity
- Java: on IdentityKeyPair and IdentityKey, respectively
- Swift: on IdentityKeyPair and IdentityKey, respectively
- Node: on IdentityKeyPair and PublicKey; Node doesn't have a separate
  IdentityKey API

For convenience, exposes IdentityKeyPair.generate() in Java and Node
as well. (This API already existed in Swift.)
2021-12-20 10:30:42 -08:00
Jordan Rose
71fdd6566e Expose SessionRecord.needsPniSignature/.setNeedsPniSignature 2021-12-20 10:21:31 -08:00
Jordan Rose
5a67a4bf0a Remove unused error FingerprintIdentifierMismatch
Fingerprint checks are done with a boolean-returning method; the error
is never thrown. Android and iOS aren't using the exception / error
case either.
2021-12-10 18:08:39 -08:00
Jordan Rose
5104d199d0 Bump to version v0.11.1 2021-12-03 13:37:25 -08:00
Jordan Rose
e4c31a62f6 Bump to version v0.11.0 2021-11-17 11:09:39 -08:00
Jordan Rose
145ba7f47c Expose PniCredential operations to app languages 2021-11-15 10:27:57 -08:00
Jordan Rose
7681db8a30 Bump to version v0.10.1 2021-11-09 09:58:20 -08:00
Jordan Rose
d2bef606d1 Bump to version v0.10.0 2021-11-08 11:45:34 -08:00
Jordan Rose
8cf56835ef zkgroup: Move blob padding/unpadding into Rust
Previously this was defined in the app layers, because zkgroup's
original codegen didn't support custom exception types. However, we
can now move it to a common implementation in Rust.
2021-11-08 11:06:32 -08:00
Jordan Rose
deeafcad51 java: Improve zkgroup's ByteArray helper class
- Don't validate sizes ahead of time if the subclass calls
  CheckValidContents anyway.
- Move serialize() up to ByteArray. Consequently, make ProfileKeyVersion
  *not* a ByteArray, since it serializes as a string.
2021-11-08 11:06:32 -08:00
Jordan Rose
3ed5fff78c java: Merge zkgroup's Hex utility class into libsignal's existing one 2021-11-08 11:06:31 -08:00
Jordan Rose
b8ec92d332 java: Update zkgroup license headers, remove codegen warnings 2021-11-08 11:06:31 -08:00
Jordan Rose
ef73a621f0 java: Get the zkgroup sources to build and pass tests
This is a pretty mechanical translation *except* for

- moving the RANDOM_LENGTH constant out of the obsolete Native class
  (libsignal-client has its own) into a new Constants class

- replacing the mocked SecureRandom with a custom subclass; Mockito
  was refusing to mock SecureRandom and honestly that's fair

- removing unused classes UUIDUtil and ZkGroupError

- updating to JUnit 4, which zkgroup's tests rely on
2021-11-08 11:06:31 -08:00
Jordan Rose
c2261d1701 java: Add the zkgroup sources verbatim (does not compile) 2021-11-08 11:04:58 -08:00
Jordan Rose
852069bdc9 bridge: Add zkgroup APIs
These APIs are designed to match the generated "simpleapi" entry
points in the original zkgroup repository, to make it easier to adapt
the existing Java, Swift, and TypeScript code to libsignal-client.

The cbindgen-generated signal_ffi.h now includes constants, so that
the fixed-size arrays used to serialize zkgroup types can use named
constants in Rust. This meant filtering out some constants that were
getting picked up but that should not be included.

Note that this commit makes references to Java exception types that
will be added in a later commit.
2021-11-08 11:04:41 -08:00
Jordan Rose
f1da238532
Merge pull request #411 from signalapp/jrose/android-save-unstripped-libraries
Android: upload unstripped libraries to Maven as well
2021-11-04 17:32:42 -07:00
Jordan Rose
4173865931 Android: upload unstripped libraries to Maven as well
This allows us to symbolicate native crash traces if necessary.
2021-11-03 16:32:02 -07:00
Jordan Rose
c65df8524d java: Build a "testable" signal-client-java as well
This is like signal-client-java, but also contains dylibs for Mac and
Windows for testing purposes. Gradle will automatically fetch these
artifacts from the corresponding GitHub release.
2021-11-01 16:54:46 -07:00
Jordan Rose
a00cfd1e90 GitHub: When a release is tagged, build and publish JNI artifacts
This will be used to build a "testable" signal-client-java.jar that
includes native libraries for macOS and Windows in addition to Linux.
This is something zkgroup already has; in particular it allows
developers working on the server to use the zkgroup APIs even if they
run macOS or Windows on their individual machines.
2021-11-01 12:53:56 -07:00
Jordan Rose
9a569f2ffe Standardize license headers
...to have a period after "Signal Messenger, LLC."

...except for the Java sources, which still need a cleanup pass.
2021-10-28 17:27:30 -07:00
Jordan Rose
a9012af8e2 Bump to version v0.9.8 2021-10-27 10:36:57 -07:00
Jordan Rose
ed2e5bce3a bridge: Update generated decls 2021-10-25 15:19:47 -07:00
Jordan Rose
ab48672d68 java: Change SignalProtocolAddress.toString to "UUID.device"
...instead of "UUID:device". Neither is inherently better than the
other but Desktop and the Rust library both use "UUID.device" already.
2021-10-19 13:03:26 -07:00
Jordan Rose
64f98ed87d java: Remove unused StaleKeyExchangeException 2021-10-19 13:03:14 -07:00
Jordan Rose
64ad39c54d Remove support for HKDF "versions"
Previously, we had HKDF-for-session-version-3, which matches RFC 5869,
and HKDF-for-session-version-2, which produced slightly different
results. However, nothing in the current versions of Signal uses
anything but the RFC-compliant version. Therefore, this commit removes
support for version 2 and deprecates the entry points that take a
version:

- Java: The HKDFv3 class is deprecated in favor of static methods on
  the HKDF class.
- Swift: The hkdf function that takes a 'version' parameter is
  deprecated in favor of a new overload that does not.
- TypeScript: The HKDF class is deprecated in favor of a top-level
  hkdf function.
- Rust: The libsignal-protocol implementation of HKDF has been removed
  entirely in favor of the hkdf crate.

There are no significant benchmark deltas from this change, and a
minimal code size increase that's the cost for removing our own
implementation of HKDF. The deprecations can be removed as a later
breaking change.
2021-10-14 16:02:56 -07:00
Jordan Rose
45fe852509 Bump to version v0.9.7 2021-10-14 15:59:42 -07:00
Jordan Rose
304a90fe56 Java: Ensure finalizers don't run until Native calls complete
If garbage collection happens at exactly the wrong time, the Java
wrapper around a Rust object (such as SessionRecord) can be finalized
while the Rust object is being used, via its opaque 'nativeHandle'
(address cast as integer). Avoid this by adding a NativeHandleGuard
type that keeps the wrapper alive, as well as a low-level entry point
`Native.keepAlive(...)` that does nothing but serve as a sort of GC
guard, similar to `Reference.reachabilityFence()` in Java 9.
2021-10-14 14:26:46 -07:00
Jordan Rose
72d3c97890 Java: Add a test for SSv2 with 1000s of recipients
This previously caused the JVM to crash because we ran out of local
reference slots.
2021-10-08 14:58:26 -07:00
Jordan Rose
169d4ca156 Gradle: Android tests should be run through Android, not JUnit 2021-10-08 14:58:26 -07:00
Jordan Rose
0bc74b32e2 Java: optimize for size over speed
This knocks about 10% off of the built binary for Android (per slice),
to balance out the increased size from the new toolchain and stdlib.
Applying the same `opt-level=s` option for `cargo bench` (on desktop)
gives a roughly 1% slowdown, a trade-off that's worth it.
2021-10-06 12:29:50 -07:00
Jordan Rose
5896c80aaf Bump version to v0.9.6 2021-10-01 16:46:56 -07:00
Jordan Rose
dc032ecb04 Java: adjust 'clean' behavior
- Run `cargo clean` when `gradlew clean` is invoked.
- But don't use `gradlew clean` in Docker except for publishing
2021-09-24 16:31:08 -07:00
Jordan Rose
f3a1dff371 Bump version to v0.9.5 2021-09-23 13:44:30 -07:00
Graeme Connell
9caa6615b9 JNI for HSM enclave client. 2021-09-21 16:37:07 -06:00
Ehren Kret
5b1d4fb0a3 Bump version to 0.9.4 2021-09-13 16:52:24 -05:00
Ehren Kret
53ecd6e589 Bump version to 0.9.3 2021-09-13 15:21:13 -05:00
Ehren Kret
2a8b4a2d97 Fix gradle build 2021-09-13 15:15:30 -05:00
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