working encryption/decryption of text and files after GeneralActivity hands it over
This commit is contained in:
@@ -110,6 +110,7 @@ public class Apg {
|
||||
public static final String SELECT_SECRET_KEY = "org.thialfihar.android.apg.intent.SELECT_SECRET_KEY";
|
||||
}
|
||||
|
||||
public static final String EXTRA_TEXT = "text";
|
||||
public static final String EXTRA_DATA = "data";
|
||||
public static final String EXTRA_STATUS = "status";
|
||||
public static final String EXTRA_ERROR = "error";
|
||||
@@ -1702,6 +1703,23 @@ public class Apg {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
public static int getStreamContent(Context context, InputStream inStream)
|
||||
throws IOException {
|
||||
InputStream in = PGPUtil.getDecoderStream(inStream);
|
||||
PGPObjectFactory pgpF = new PGPObjectFactory(in);
|
||||
Object object = pgpF.nextObject();
|
||||
while (object != null) {
|
||||
if (object instanceof PGPPublicKeyRing ||
|
||||
object instanceof PGPSecretKeyRing) {
|
||||
return Id.content.keys;
|
||||
} else if (object instanceof PGPEncryptedDataList) {
|
||||
return Id.content.encrypted_data;
|
||||
}
|
||||
}
|
||||
|
||||
return Id.content.unknown;
|
||||
}
|
||||
|
||||
// taken from ClearSignedFileProcessor in BC
|
||||
private static int readInputLine(ByteArrayOutputStream bOut, InputStream fIn)
|
||||
throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user