mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
commit
768c264d20
@ -7,7 +7,6 @@
|
|||||||
package org.whispersystems.libsignal.ecc;
|
package org.whispersystems.libsignal.ecc;
|
||||||
|
|
||||||
import org.signal.client.internal.Native;
|
import org.signal.client.internal.Native;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class ECPublicKey implements Comparable<ECPublicKey> {
|
public class ECPublicKey implements Comparable<ECPublicKey> {
|
||||||
@ -24,6 +23,13 @@ public class ECPublicKey implements Comparable<ECPublicKey> {
|
|||||||
this.handle = Native.ECPublicKey_Deserialize(serialized, 0);
|
this.handle = Native.ECPublicKey_Deserialize(serialized, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public ECPublicKey fromPublicKeyBytes(byte[] key) {
|
||||||
|
byte[] with_type = new byte[33];
|
||||||
|
with_type[0] = 0x05;
|
||||||
|
System.arraycopy(key, 0, with_type, 1, 32);
|
||||||
|
return new ECPublicKey(Native.ECPublicKey_Deserialize(with_type, 0));
|
||||||
|
}
|
||||||
|
|
||||||
public ECPublicKey(long nativeHandle) {
|
public ECPublicKey(long nativeHandle) {
|
||||||
if (nativeHandle == 0) {
|
if (nativeHandle == 0) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
@ -266,7 +266,11 @@ pub unsafe extern "system" fn Java_org_signal_client_internal_Native_HKDF_1Deriv
|
|||||||
Some(env.convert_byte_array(salt)?)
|
Some(env.convert_byte_array(salt)?)
|
||||||
};
|
};
|
||||||
|
|
||||||
let info = env.convert_byte_array(info)?;
|
let info = if info.is_null() {
|
||||||
|
vec![]
|
||||||
|
} else {
|
||||||
|
env.convert_byte_array(info)?
|
||||||
|
};
|
||||||
|
|
||||||
let hkdf = HKDF::new(version)?;
|
let hkdf = HKDF::new(version)?;
|
||||||
let derived = if let Some(salt) = salt {
|
let derived = if let Some(salt) = salt {
|
||||||
|
Loading…
Reference in New Issue
Block a user