mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-10 09:02:05 +02:00
Device Sender Utilities - Generate Key + Self-Signed Certificate
This commit is contained in:
@@ -74,6 +74,9 @@ public final class Native {
|
||||
public static native byte[] Aes256GcmSiv_Encrypt(long aesGcmSiv, byte[] ptext, byte[] nonce, byte[] associatedData);
|
||||
public static native long Aes256GcmSiv_New(byte[] key);
|
||||
|
||||
public static native byte[] DeviceTransfer_GenerateCertificate(byte[] privateKey, String name, int daysToExpire);
|
||||
public static native byte[] DeviceTransfer_GeneratePrivateKey();
|
||||
|
||||
public static native byte[] ECPrivateKey_Agree(long privateKey, long publicKey);
|
||||
public static native long ECPrivateKey_Deserialize(byte[] data);
|
||||
public static native void ECPrivateKey_Destroy(long handle);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Copyright 2021 Signal Messenger, LLC.
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
package org.signal.libsignal.devicetransfer;
|
||||
|
||||
import org.signal.client.internal.Native;
|
||||
|
||||
class DeviceTransferKey {
|
||||
byte[] keyMaterial;
|
||||
|
||||
DeviceTransferKey() {
|
||||
this.keyMaterial = Native.DeviceTransfer_GeneratePrivateKey();
|
||||
}
|
||||
|
||||
byte[] generateCertificate(String name, int daysTilExpires) {
|
||||
return Native.DeviceTransfer_GenerateCertificate(this.keyMaterial, name, daysTilExpires);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user