Allow to pass large blobs and a new content provider to simplify this

Since AIDL is not for passing large data, a blob can be passed to APG by
a Uri. This Uri is opened as a file by APG and read/written to. Note the
file is overwritten by APG, so make sure it is a copy if you want to
keep the original.

With the ApgServiceBlobProvider, Apg has an own ContentProvider that can
be used like mentioned above. For now the data is stored in the dir
where APG stores other files and NOT DELETED after en/decryption. This
is tbd. It can only be accessed by an application with the permission
"org.thialfihar.android.apg.permission.STORE_BLOBS".

ApgCon has been updated accordingly and can handle blobs with `setBlob`
and `getBlobResult`. That is a really easy way to en/decrypt large data.

Note that encrypting by blob should only be used for large files (1MB+).
On all other cases, the data should be passed as as String through the
AIDl-Interface, so no temporary file must be created.

See ApgCon for a complete example of how to connect to the AIDL and use
it. Or use it in your own project!
This commit is contained in:
Markus Doits
2011-11-04 21:22:49 +01:00
parent a7294d50b1
commit ad16574657
10 changed files with 422 additions and 35 deletions

View File

@@ -204,12 +204,17 @@
<intent-filter>
<action android:name="org.thialfihar.android.apg.IApgService"/>
</intent-filter>
<meta-data android:name="api_version" android:value="1" />
<meta-data android:name="api_version" android:value="2" />
</service>
<provider
android:readPermission="org.thialfihar.android.apg.permission.READ_KEY_DETAILS"
android:name="org.thialfihar.android.apg.provider.DataProvider"
android:authorities="org.thialfihar.android.apg.provider"/>
<provider
android:permission="org.thialfihar.android.apg.permission.STORE_BLOBS"
android:name="org.thialfihar.android.apg.provider.ApgServiceBlobProvider"
android:authorities="org.thialfihar.android.apg.provider.apgserviceblobprovider"/>
</application>
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
@@ -219,10 +224,16 @@
android:label="@string/permission_read_key_details_label"
android:description="@string/permission_read_key_details_description"/>
<permission android:name="org.thialfihar.android.apg.permission.STORE_BLOBS"
android:protectionLevel="dangerous"
android:label="@string/permission_store_blobs_label"
android:description="@string/permission_store_blobs_description"/>
<uses-permission android:name="com.google.android.providers.gmail.permission.READ_GMAIL" />
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.fsck.k9.permission.READ_ATTACHMENT" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="org.thialfihar.android.apg.permission.STORE_BLOBS"/>
</manifest>