mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Preparation for other app settings
This commit is contained in:
parent
227b277931
commit
7d3113ca15
@ -788,6 +788,7 @@ public class PgpMain {
|
|||||||
}
|
}
|
||||||
updateProgress(progress, R.string.progress_preparingStreams, 5, 100);
|
updateProgress(progress, R.string.progress_preparingStreams, 5, 100);
|
||||||
|
|
||||||
|
Log.d(Constants.TAG, "as"+symmetricEncryptionAlgorithm);
|
||||||
// encrypt and compress input file content
|
// encrypt and compress input file content
|
||||||
JcePGPDataEncryptorBuilder encryptorBuilder = new JcePGPDataEncryptorBuilder(
|
JcePGPDataEncryptorBuilder encryptorBuilder = new JcePGPDataEncryptorBuilder(
|
||||||
symmetricEncryptionAlgorithm).setProvider(BOUNCY_CASTLE_PROVIDER_NAME)
|
symmetricEncryptionAlgorithm).setProvider(BOUNCY_CASTLE_PROVIDER_NAME)
|
||||||
|
@ -741,27 +741,26 @@ public class ProviderHelper {
|
|||||||
return packageNames;
|
return packageNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void contentValueForApiApps() {
|
private static ContentValues contentValueForApiApps(AppSettings appSettings) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void insertApiApp(Context context, AppSettings appSettings) {
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(ApiApps.PACKAGE_NAME, appSettings.getPackageName());
|
values.put(ApiApps.PACKAGE_NAME, appSettings.getPackageName());
|
||||||
values.put(ApiApps.KEY_ID, appSettings.getKeyId());
|
values.put(ApiApps.KEY_ID, appSettings.getKeyId());
|
||||||
values.put(ApiApps.ASCII_ARMOR, appSettings.isAsciiArmor());
|
values.put(ApiApps.ASCII_ARMOR, appSettings.isAsciiArmor());
|
||||||
// TODO: other parameters
|
values.put(ApiApps.COMPRESSION, appSettings.getCompression());
|
||||||
context.getContentResolver().insert(ApiApps.CONTENT_URI, values);
|
values.put(ApiApps.ENCRYPTION_ALGORITHM, appSettings.getEncryptionAlgorithm());
|
||||||
|
values.put(ApiApps.HASH_ALORITHM, appSettings.getHashAlgorithm());
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void insertApiApp(Context context, AppSettings appSettings) {
|
||||||
|
context.getContentResolver().insert(ApiApps.CONTENT_URI,
|
||||||
|
contentValueForApiApps(appSettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateApiApp(Context context, AppSettings appSettings, Uri uri) {
|
public static void updateApiApp(Context context, AppSettings appSettings, Uri uri) {
|
||||||
final ContentValues cv = new ContentValues();
|
if (context.getContentResolver().update(uri, contentValueForApiApps(appSettings), null,
|
||||||
cv.put(KeychainContract.ApiApps.KEY_ID, appSettings.getKeyId());
|
null) <= 0) {
|
||||||
|
|
||||||
cv.put(KeychainContract.ApiApps.ASCII_ARMOR, appSettings.isAsciiArmor());
|
|
||||||
// TODO: other parameters
|
|
||||||
|
|
||||||
if (context.getContentResolver().update(uri, cv, null, null) <= 0) {
|
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -775,17 +774,15 @@ public class ProviderHelper {
|
|||||||
if (cur.moveToFirst()) {
|
if (cur.moveToFirst()) {
|
||||||
settings.setPackageName(cur.getString(cur
|
settings.setPackageName(cur.getString(cur
|
||||||
.getColumnIndex(KeychainContract.ApiApps.PACKAGE_NAME)));
|
.getColumnIndex(KeychainContract.ApiApps.PACKAGE_NAME)));
|
||||||
|
|
||||||
settings.setKeyId(cur.getLong(cur.getColumnIndex(KeychainContract.ApiApps.KEY_ID)));
|
settings.setKeyId(cur.getLong(cur.getColumnIndex(KeychainContract.ApiApps.KEY_ID)));
|
||||||
|
|
||||||
settings.setAsciiArmor(cur.getInt(cur
|
settings.setAsciiArmor(cur.getInt(cur
|
||||||
.getColumnIndexOrThrow(KeychainContract.ApiApps.ASCII_ARMOR)) == 1);
|
.getColumnIndexOrThrow(KeychainContract.ApiApps.ASCII_ARMOR)) == 1);
|
||||||
|
settings.setCompression(cur.getInt(cur
|
||||||
settings.setPackageName(cur.getString(cur
|
.getColumnIndexOrThrow(KeychainContract.ApiApps.COMPRESSION)));
|
||||||
.getColumnIndex(KeychainContract.ApiApps.PACKAGE_NAME)));
|
settings.setHashAlgorithm(cur.getInt(cur
|
||||||
|
.getColumnIndexOrThrow(KeychainContract.ApiApps.HASH_ALORITHM)));
|
||||||
settings.setPackageName(cur.getString(cur
|
settings.setEncryptionAlgorithm(cur.getInt(cur
|
||||||
.getColumnIndex(KeychainContract.ApiApps.PACKAGE_NAME)));
|
.getColumnIndexOrThrow(KeychainContract.ApiApps.ENCRYPTION_ALGORITHM)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.remote_api;
|
package org.sufficientlysecure.keychain.remote_api;
|
||||||
|
|
||||||
|
import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||||
|
import org.spongycastle.openpgp.PGPEncryptedData;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
import org.sufficientlysecure.keychain.Id;
|
||||||
|
|
||||||
public class AppSettings {
|
public class AppSettings {
|
||||||
@ -36,9 +38,9 @@ public class AppSettings {
|
|||||||
this.packageName = packageName;
|
this.packageName = packageName;
|
||||||
// defaults:
|
// defaults:
|
||||||
this.asciiArmor = true;
|
this.asciiArmor = true;
|
||||||
this.encryptionAlgorithm = 7; // AES-128
|
this.encryptionAlgorithm = PGPEncryptedData.AES_128; // AES-128
|
||||||
this.hashAlgorithm = 10; // SHA-512
|
this.hashAlgorithm = HashAlgorithmTags.SHA512; // SHA-512
|
||||||
this.compression = 2; // zlib
|
this.compression = Id.choice.compression.zlib; // zlib
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public String getPackageName() {
|
||||||
|
Loading…
Reference in New Issue
Block a user