Update to latest version in master

Merge branch 'master' into apg_service

Conflicts:
	src/org/thialfihar/android/apg/Apg.java
	src/org/thialfihar/android/apg/Preferences.java
This commit is contained in:
Markus Doits
2011-11-03 20:14:24 +01:00
5 changed files with 391 additions and 16 deletions

View File

@@ -1262,6 +1262,7 @@ public class Apg {
}
if( progress != null )
progress.setProgress(R.string.progress_preparingStreams, 5, 100);
// encrypt and compress input file content
PGPEncryptedDataGenerator cPk =
new PGPEncryptedDataGenerator(symmetricAlgorithm, true, new SecureRandom(),
@@ -1327,6 +1328,7 @@ public class Apg {
new Date(), new byte[1 << 16]);
if( progress != null )
progress.setProgress(R.string.progress_encrypting, 20, 100);
long done = 0;
int n = 0;
byte[] buffer = new byte[1 << 16];

View File

@@ -18,6 +18,7 @@ package org.thialfihar.android.apg;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
@@ -30,6 +31,7 @@ import org.bouncycastle2.openpgp.PGPPublicKey;
import org.bouncycastle2.openpgp.PGPPublicKeyRing;
import org.bouncycastle2.openpgp.PGPSecretKey;
import org.bouncycastle2.openpgp.PGPSecretKeyRing;
import org.thialfihar.android.apg.provider.DataProvider;
import org.thialfihar.android.apg.utils.Choice;
import android.app.Dialog;
@@ -699,21 +701,30 @@ public class EncryptActivity extends BaseActivity {
out.close();
if (mEncryptTarget != Id.target.file) {
if (useAsciiArmour) {
String extraData = new String(((ByteArrayOutputStream)out).toByteArray());
if (mGenerateSignature) {
data.putString(Apg.EXTRA_SIGNATURE_TEXT, extraData);
} else {
data.putString(Apg.EXTRA_ENCRYPTED_MESSAGE, extraData);
}
} else {
byte extraData[] = ((ByteArrayOutputStream)out).toByteArray();
if (mGenerateSignature) {
data.putByteArray(Apg.EXTRA_SIGNATURE_DATA, extraData);
} else {
data.putByteArray(Apg.EXTRA_ENCRYPTED_DATA, extraData);
}
}
if(out instanceof ByteArrayOutputStream) {
if (useAsciiArmour) {
String extraData = new String(((ByteArrayOutputStream)out).toByteArray());
if (mGenerateSignature) {
data.putString(Apg.EXTRA_SIGNATURE_TEXT, extraData);
} else {
data.putString(Apg.EXTRA_ENCRYPTED_MESSAGE, extraData);
}
} else {
byte extraData[] = ((ByteArrayOutputStream)out).toByteArray();
if (mGenerateSignature) {
data.putByteArray(Apg.EXTRA_SIGNATURE_DATA, extraData);
} else {
data.putByteArray(Apg.EXTRA_ENCRYPTED_DATA, extraData);
}
}
} else if(out instanceof FileOutputStream) {
String fileName = mDataDestination.getStreamFilename();
String uri = "content://" + DataProvider.AUTHORITY + "/data/" + fileName;
data.putString(Apg.EXTRA_RESULT_URI, uri);
} else {
throw new Apg.GeneralException("No output-data found.");
}
}
} catch (IOException e) {
error = "" + e;