wrapped-key-ring: more refactoring - no more pgp imports in KeychainIntentService!

This commit is contained in:
Vincent Breitmoser
2014-05-03 22:29:09 +02:00
parent 32baf42515
commit f524fa692c
14 changed files with 212 additions and 272 deletions

View File

@@ -43,6 +43,8 @@ import org.sufficientlysecure.keychain.pgp.CachedPublicKeyRing;
import org.sufficientlysecure.keychain.pgp.PgpConversionHelper;
import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
import org.sufficientlysecure.keychain.pgp.UncachedSecretKeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiApps;
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRingData;
@@ -484,12 +486,22 @@ public class ProviderHelper {
}
}
/**
* Saves a PGPSecretKeyRing in the DB. This will only work if a corresponding public keyring
* is already in the database!
*/
public void saveKeyRing(UncachedSecretKeyRing wrappedRing) throws IOException {
// TODO split up getters
PGPSecretKeyRing keyRing = wrappedRing.getSecretKeyRing();
saveKeyRing(keyRing);
}
/**
* Saves a PGPSecretKeyRing in the DB. This will only work if a corresponding public keyring
* is already in the database!
*/
public void saveKeyRing(PGPSecretKeyRing keyRing) throws IOException {
long masterKeyId = keyRing.getPublicKey().getKeyID();
long masterKeyId = keyRing.getSecretKey().getKeyID();
{
Uri uri = Keys.buildKeysUri(Long.toString(masterKeyId));
@@ -526,6 +538,12 @@ public class ProviderHelper {
}
public void saveKeyRing(UncachedKeyRing wrappedRing) throws IOException {
PGPPublicKeyRing pubRing = wrappedRing.getPublicRing();
PGPSecretKeyRing secRing = wrappedRing.getSecretRing();
saveKeyRing(pubRing, secRing);
}
/**
* Saves (or updates) a pair of public and secret KeyRings in the database
*/