Encrypt and save crash reports, send them the next time TorPlugin start

Will currently fail at runtime; requires a public key and a server onion.
This commit is contained in:
str4d
2016-03-31 11:11:55 +00:00
parent 28086cd359
commit d545aaa892
18 changed files with 342 additions and 32 deletions

View File

@@ -3,6 +3,7 @@ package org.briarproject.api.crypto;
import org.briarproject.api.TransportId;
import org.briarproject.api.transport.TransportKeys;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
@@ -156,4 +157,9 @@ public interface CryptoComponent {
* authenticated (for example, if the password is wrong).
*/
byte[] decryptWithPassword(byte[] ciphertext, String password);
/**
* Encrypts the given plaintext to the given public key.
*/
String encryptToKey(byte[] publicKey, byte[] plaintext);
}

View File

@@ -0,0 +1,10 @@
package org.briarproject.api.reporting;
public interface DevConfig {
byte[] getDevPublicKey();
String getDevOnionAddress();
int getDevReportPort();
}

View File

@@ -0,0 +1,28 @@
package org.briarproject.api.reporting;
import java.io.File;
import java.io.FileNotFoundException;
/**
* A task for reporting back to the developers.
*/
public interface DevReporter {
/**
* Store a crash report encrypted on-disk to be sent later.
*
* @param crashReportDir the directory where crash reports are stored.
* @param crashReport the crash report in the form expected by the server.
* @throws FileNotFoundException if the report could not be written.
*/
void encryptCrashReportToFile(File crashReportDir, String crashReport)
throws FileNotFoundException;
/**
* Send crash reports previously stored on-disk.
*
* @param crashReportDir the directory where crash reports are stored.
* @param socksPort the SOCKS port of a Tor client.
*/
void sendCrashReports(File crashReportDir, int socksPort);
}