mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 00:18:51 -05:00
applied proposed patch by mattispasch for issue 99
This commit is contained in:
parent
4e37568eab
commit
3a22ac4197
@ -18,6 +18,7 @@ package org.thialfihar.android.apg;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@ -30,6 +31,7 @@ import org.bouncycastle2.openpgp.PGPPublicKey;
|
|||||||
import org.bouncycastle2.openpgp.PGPPublicKeyRing;
|
import org.bouncycastle2.openpgp.PGPPublicKeyRing;
|
||||||
import org.bouncycastle2.openpgp.PGPSecretKey;
|
import org.bouncycastle2.openpgp.PGPSecretKey;
|
||||||
import org.bouncycastle2.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle2.openpgp.PGPSecretKeyRing;
|
||||||
|
import org.thialfihar.android.apg.provider.DataProvider;
|
||||||
import org.thialfihar.android.apg.utils.Choice;
|
import org.thialfihar.android.apg.utils.Choice;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -699,6 +701,8 @@ public class EncryptActivity extends BaseActivity {
|
|||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
if (mEncryptTarget != Id.target.file) {
|
if (mEncryptTarget != Id.target.file) {
|
||||||
|
|
||||||
|
if(out instanceof ByteArrayOutputStream) {
|
||||||
if (useAsciiArmour) {
|
if (useAsciiArmour) {
|
||||||
String extraData = new String(((ByteArrayOutputStream)out).toByteArray());
|
String extraData = new String(((ByteArrayOutputStream)out).toByteArray());
|
||||||
if (mGenerateSignature) {
|
if (mGenerateSignature) {
|
||||||
@ -714,6 +718,13 @@ public class EncryptActivity extends BaseActivity {
|
|||||||
data.putByteArray(Apg.EXTRA_ENCRYPTED_DATA, extraData);
|
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) {
|
} catch (IOException e) {
|
||||||
error = "" + e;
|
error = "" + e;
|
||||||
|
Loading…
Reference in New Issue
Block a user