@@ -173,43 +173,10 @@ namespace util {
173
173
}
174
174
}
175
175
176
- extern " C"
177
- JNIEXPORT jobject JNICALL
178
- Java_network_loki_messenger_libsession_1util_util_Sodium_ed25519KeyPair (JNIEnv *env, jobject thiz, jbyteArray seed) {
179
- std::array<unsigned char , 32 > ed_pk; // NOLINT(cppcoreguidelines-pro-type-member-init)
180
- std::array<unsigned char , 64 > ed_sk; // NOLINT(cppcoreguidelines-pro-type-member-init)
181
- auto seed_bytes = util::vector_from_bytes (env, seed);
182
- crypto_sign_ed25519_seed_keypair (ed_pk.data (), ed_sk.data (), seed_bytes.data ());
183
-
184
- auto kp_class = jni_utils::JavaLocalRef (env, env->FindClass (" network/loki/messenger/libsession_util/util/KeyPair" ));
185
- jmethodID kp_constructor = env->GetMethodID (kp_class.get (), " <init>" , " (Lnetwork/loki/messenger/libsession_util/util/Bytes;Lnetwork/loki/messenger/libsession_util/util/Bytes;)V" );
186
-
187
- return env->NewObject (kp_class.get (), kp_constructor,
188
- jni_utils::JavaLocalRef (env, jni_utils::session_bytes_from_range (env, ed_pk)).get (),
189
- jni_utils::JavaLocalRef (env, jni_utils::session_bytes_from_range (env, ed_sk)).get ()
190
- );
191
- }
192
-
193
- extern " C"
194
- JNIEXPORT jbyteArray JNICALL
195
- Java_network_loki_messenger_libsession_1util_util_Sodium_ed25519PkToCurve25519 (JNIEnv *env,
196
- jobject thiz,
197
- jbyteArray pk) {
198
- auto ed_pk = util::vector_from_bytes (env, pk);
199
- std::array<unsigned char , 32 > curve_pk; // NOLINT(cppcoreguidelines-pro-type-member-init)
200
- int success = crypto_sign_ed25519_pk_to_curve25519 (curve_pk.data (), ed_pk.data ());
201
- if (success != 0 ) {
202
- jclass exception = env->FindClass (" java/lang/Exception" );
203
- env->ThrowNew (exception, " Invalid crypto_sign_ed25519_pk_to_curve25519 operation" );
204
- return nullptr ;
205
- }
206
- jbyteArray curve_pk_jarray = util::bytes_from_span (env, std::span<const unsigned char > {curve_pk.data (), curve_pk.size ()});
207
- return curve_pk_jarray;
208
- }
209
176
210
177
extern " C"
211
178
JNIEXPORT jbyteArray JNICALL
212
- Java_network_loki_messenger_libsession_1util_util_Sodium_encryptForMultipleSimple (
179
+ Java_network_loki_messenger_libsession_1util_util_MultiEncrypt_encryptForMultipleSimple (
213
180
JNIEnv *env, jobject thiz, jobjectArray messages, jobjectArray recipients,
214
181
jbyteArray ed25519_secret_key, jstring domain) {
215
182
// messages and recipients have to be the same size
@@ -258,12 +225,12 @@ Java_network_loki_messenger_libsession_1util_util_Sodium_encryptForMultipleSimpl
258
225
259
226
extern " C"
260
227
JNIEXPORT jbyteArray JNICALL
261
- Java_network_loki_messenger_libsession_1util_util_Sodium_decryptForMultipleSimple (JNIEnv *env,
262
- jobject thiz,
263
- jbyteArray encoded,
264
- jbyteArray secret_key,
265
- jbyteArray sender_pub_key,
266
- jstring domain) {
228
+ Java_network_loki_messenger_libsession_1util_util_MultiEncrypt_decryptForMultipleSimple (JNIEnv *env,
229
+ jobject thiz,
230
+ jbyteArray encoded,
231
+ jbyteArray secret_key,
232
+ jbyteArray sender_pub_key,
233
+ jstring domain) {
267
234
auto sk_vector = util::vector_from_bytes (env, secret_key);
268
235
auto encoded_vector = util::vector_from_bytes (env, encoded);
269
236
auto pub_vector = util::vector_from_bytes (env, sender_pub_key);
0 commit comments