From 9f38c1436c1d22212a72c40f477e6b2aa2d367c5 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Thu, 30 Jan 2014 15:43:08 +0000 Subject: [PATCH 1/9] save work --- .../keychain/pgp/PgpKeyOperation.java | 46 ++++--------------- .../service/KeychainIntentService.java | 10 ++-- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index d6f130682..85c3ed9d2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -103,15 +103,12 @@ public class PgpKeyOperation { } /** - * Creates new secret key. The returned PGPSecretKeyRing contains only one newly generated key - * when this key is the new masterkey. If a masterkey is supplied in the parameters - * PGPSecretKeyRing contains the masterkey and the new key as a subkey (certified by the - * masterkey). + * Creates new secret key. * * @param algorithmChoice * @param keySize * @param passPhrase - * @param masterSecretKey + * @param isMasterKey * @return * @throws NoSuchAlgorithmException * @throws PGPException @@ -119,9 +116,9 @@ public class PgpKeyOperation { * @throws PgpGeneralException * @throws InvalidAlgorithmParameterException */ - public PGPSecretKeyRing createKey(int algorithmChoice, int keySize, String passPhrase, - PGPSecretKey masterSecretKey) throws NoSuchAlgorithmException, PGPException, - NoSuchProviderException, PgpGeneralException, InvalidAlgorithmParameterException { + public PGPSecretKey createKey(int algorithmChoice, int keySize, String passPhrase, + boolean isMasterKey) throws NoSuchAlgorithmException, PGPException, NoSuchProviderException, + PgpGeneralException, InvalidAlgorithmParameterException { if (keySize < 512) { throw new PgpGeneralException(mContext.getString(R.string.error_key_size_minimum512bit)); @@ -143,7 +140,7 @@ public class PgpKeyOperation { } case Id.choice.algorithm.elgamal: { - if (masterSecretKey == null) { + if (isMasterKey) { throw new PgpGeneralException( mContext.getString(R.string.error_master_key_must_not_be_el_gamal)); } @@ -183,36 +180,11 @@ public class PgpKeyOperation { PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder( PGPEncryptedData.CAST5, sha1Calc) .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passPhrase.toCharArray()); - PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( - Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passPhrase.toCharArray()); - PGPKeyRingGenerator ringGen = null; - PGPContentSignerBuilder certificationSignerBuilder = null; - if (masterSecretKey == null) { - certificationSignerBuilder = new JcaPGPContentSignerBuilder(keyPair.getPublicKey() - .getAlgorithm(), HashAlgorithmTags.SHA1); + PGPSecretKey secKey = new PGPSecretKey(keyPair.getPrivateKey(), keyPair.getPublicKey(), + sha1Calc, isMasterKey, keyEncryptor); - // build keyRing with only this one master key in it! - ringGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, keyPair, "", - sha1Calc, null, null, certificationSignerBuilder, keyEncryptor); - } else { - PGPPublicKey masterPublicKey = masterSecretKey.getPublicKey(); - PGPPrivateKey masterPrivateKey = masterSecretKey.extractPrivateKey(keyDecryptor); - PGPKeyPair masterKeyPair = new PGPKeyPair(masterPublicKey, masterPrivateKey); - - certificationSignerBuilder = new JcaPGPContentSignerBuilder(masterKeyPair - .getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA1); - - // build keyRing with master key and new key as subkey (certified by masterkey) - ringGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, masterKeyPair, - "", sha1Calc, null, null, certificationSignerBuilder, keyEncryptor); - - ringGen.addSubKey(keyPair); - } - - PGPSecretKeyRing secKeyRing = ringGen.generateSecretKeyRing(); - - return secKeyRing; + return secKey; } public void changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassPhrase, diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index b02e08dda..5c67e289c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -561,21 +561,17 @@ public class KeychainIntentService extends IntentService implements ProgressDial int algorithm = data.getInt(GENERATE_KEY_ALGORITHM); String passphrase = data.getString(GENERATE_KEY_SYMMETRIC_PASSPHRASE); int keysize = data.getInt(GENERATE_KEY_KEY_SIZE); - PGPSecretKey masterKey = null; - if (data.containsKey(GENERATE_KEY_MASTER_KEY)) { - masterKey = PgpConversionHelper.BytesToPGPSecretKey(data - .getByteArray(GENERATE_KEY_MASTER_KEY)); - } + boolean masterKey = data.getBoolean(GENERATE_KEY_MASTER_KEY); /* Operation */ PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); - PGPSecretKeyRing newKeyRing = keyOperations.createKey(algorithm, keysize, + PGPSecretKey newKey = keyOperations.createKey(algorithm, keysize, passphrase, masterKey); /* Output */ Bundle resultData = new Bundle(); resultData.putByteArray(RESULT_NEW_KEY, - PgpConversionHelper.PGPSecretKeyRingToBytes(newKeyRing)); + PgpConversionHelper.PGPSecretKeyToBytes(newKey)); OtherHelper.logDebugBundle(resultData, "resultData"); From 715ba7604cb9ac3b83248c15e68f28e6561304f4 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Thu, 30 Jan 2014 15:43:33 +0000 Subject: [PATCH 2/9] needs to be public... --- .../pg/src/main/java/org/spongycastle/openpgp/PGPSecretKey.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKey.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKey.java index d705e5ce6..c0f7dfa3b 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKey.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKey.java @@ -64,7 +64,7 @@ public class PGPSecretKey this(privKey, pubKey, checksumCalculator, false, keyEncryptor); } - PGPSecretKey( + public PGPSecretKey( PGPPrivateKey privKey, PGPPublicKey pubKey, PGPDigestCalculator checksumCalculator, From fa0bd5edb4411ff227f49038ab597e84c938a7a9 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Thu, 30 Jan 2014 15:50:24 +0000 Subject: [PATCH 3/9] builds, but intents are not called or handled correctly --- .../keychain/service/KeychainIntentService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 5c67e289c..c7f26fe2b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -588,18 +588,21 @@ public class KeychainIntentService extends IntentService implements ProgressDial /* Operation */ PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); - PGPSecretKeyRing masterKeyRing = keyOperations.createKey(Id.choice.algorithm.rsa, - 4096, passphrase, null); + PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa, + 4096, passphrase, true); - PGPSecretKeyRing subKeyRing = keyOperations.createKey(Id.choice.algorithm.rsa, - 4096, passphrase, masterKeyRing.getSecretKey()); + PGPSecretKey subKey = keyOperations.createKey(Id.choice.algorithm.rsa, + 4096, passphrase, false); + + // TODO: default to one master for cert, one sub for encrypt and one sub + // for sign /* Output */ Bundle resultData = new Bundle(); resultData.putByteArray(RESULT_NEW_KEY, - PgpConversionHelper.PGPSecretKeyRingToBytes(masterKeyRing)); + PgpConversionHelper.PGPSecretKeyToBytes(masterKey)); resultData.putByteArray(RESULT_NEW_KEY2, - PgpConversionHelper.PGPSecretKeyRingToBytes(subKeyRing)); + PgpConversionHelper.PGPSecretKeyToBytes(subKey)); OtherHelper.logDebugBundle(resultData, "resultData"); From 617f117e23765bf0b6d113d40e9c0f323d39a8cf Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Fri, 31 Jan 2014 11:44:10 +0000 Subject: [PATCH 4/9] generate single key --- .../keychain/pgp/PgpKeyOperation.java | 2 ++ .../keychain/ui/widget/SectionView.java | 28 +++++-------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index 85c3ed9d2..9782d1ac2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -116,6 +116,8 @@ public class PgpKeyOperation { * @throws PgpGeneralException * @throws InvalidAlgorithmParameterException */ + + // TODO: key flags? public PGPSecretKey createKey(int algorithmChoice, int keySize, String passPhrase, boolean isMasterKey) throws NoSuchAlgorithmException, PGPException, NoSuchProviderException, PgpGeneralException, InvalidAlgorithmParameterException { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 1f9605fb1..4c8a50c90 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -290,18 +290,19 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor // fill values for this action Bundle data = new Bundle(); + Boolean isMasterKey; String passPhrase; if (mEditors.getChildCount() > 0) { PGPSecretKey masterKey = ((KeyEditor) mEditors.getChildAt(0)).getValue(); passPhrase = PassphraseCacheService .getCachedPassphrase(mActivity, masterKey.getKeyID()); - - data.putByteArray(KeychainIntentService.GENERATE_KEY_MASTER_KEY, - PgpConversionHelper.PGPSecretKeyToBytes(masterKey)); + isMasterKey = true; } else { passPhrase = ""; + isMasterKey = false; } + data.putBoolean(KeychainIntentService.GENERATE_KEY_MASTER_KEY, isMasterKey); data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passPhrase); data.putInt(KeychainIntentService.GENERATE_KEY_ALGORITHM, mNewKeyAlgorithmChoice.getId()); data.putInt(KeychainIntentService.GENERATE_KEY_KEY_SIZE, mNewKeySize); @@ -322,30 +323,15 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { // get new key from data bundle returned from service Bundle data = message.getData(); - PGPSecretKeyRing newKeyRing = (PGPSecretKeyRing) PgpConversionHelper - .BytesToPGPKeyRing(data + PGPSecretKey newKey = (PGPSecretKey) PgpConversionHelper + .BytesToPGPKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY)); - boolean isMasterKey = (mEditors.getChildCount() == 0); - - // take only the key from this ring - PGPSecretKey newKey = null; - @SuppressWarnings("unchecked") - Iterator it = newKeyRing.getSecretKeys(); - - if (isMasterKey) { - newKey = it.next(); - } else { - // first one is the master key - it.next(); - newKey = it.next(); - } - // add view with new key KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item, mEditors, false); view.setEditorListener(SectionView.this); - view.setValue(newKey, isMasterKey, -1); + view.setValue(newKey, newKey.isMasterKey(), -1); mEditors.addView(view); SectionView.this.updateEditorsVisible(); } From f7afa0c8200db25feb8415de35ea83585e7cd7ce Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Fri, 31 Jan 2014 11:49:08 +0000 Subject: [PATCH 5/9] default keys gen --- .../keychain/ui/EditKeyActivity.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index cf11ffa48..85c1177df 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -193,25 +193,21 @@ public class EditKeyActivity extends SherlockFragmentActivity { if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { // get new key from data bundle returned from service Bundle data = message.getData(); - PGPSecretKeyRing masterKeyRing = (PGPSecretKeyRing) PgpConversionHelper - .BytesToPGPKeyRing(data + PGPSecretKeyRing masterKey = (PGPSecretKey) PgpConversionHelper + .BytesToPGPKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY)); - PGPSecretKeyRing subKeyRing = (PGPSecretKeyRing) PgpConversionHelper - .BytesToPGPKeyRing(data + PGPSecretKey subKey = (PGPSecretKey) PgpConversionHelper + .BytesToPGPKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY2)); // add master key - @SuppressWarnings("unchecked") - Iterator masterIt = masterKeyRing.getSecretKeys(); - mKeys.add(masterIt.next()); - mKeysUsages.add(Id.choice.usage.sign_only); + mKeys.add(maskterKey); + mKeysUsages.add(Id.choice.usage.sign_only); //TODO: get from key flags // add sub key - @SuppressWarnings("unchecked") - Iterator subIt = subKeyRing.getSecretKeys(); subIt.next(); // masterkey - mKeys.add(subIt.next()); - mKeysUsages.add(Id.choice.usage.encrypt_only); + mKeys.add(subKey); + mKeysUsages.add(Id.choice.usage.encrypt_only); //TODO: get from key flags buildLayout(); } From 7897c6fadd2a285f8b2b52f56b71741a44f13f03 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Fri, 31 Jan 2014 15:19:07 +0000 Subject: [PATCH 6/9] more probable changes for spongycastle2 --- .../openpgp/PGPObjectFactory.java | 9 +++++++++ .../openpgp/PGPSecretKeyRing.java | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java index 11fb3a53c..73b11b9a1 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java @@ -103,6 +103,15 @@ public class PGPObjectFactory { throw new IOException("can't create secret key object: " + e); } + case PacketTags.SECRET_SUBKEY: + try + { + return PGPSecretKeyRing.readSubkey(in, fingerPrintCalculator); + } + catch (PGPException e) + { + throw new IOException("processing error: " + e.getMessage()); + } case PacketTags.PUBLIC_KEY: return new PGPPublicKeyRing(in, fingerPrintCalculator); case PacketTags.PUBLIC_SUBKEY: diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java index c182a1f1e..4805721a8 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java @@ -477,4 +477,23 @@ public class PGPSecretKeyRing return new PGPSecretKeyRing(keys, secRing.extraPubKeys); } + + static PGPSecretKey readSubkey(BCPGInputStream in, KeyFingerPrintCalculator fingerPrintCalculator) + throws IOException, PGPException + { + SecretSubkeyPacket sub = (SecretSubkeyPacket)in.readPacket(); + + // + // ignore GPG comment packets if found. + // + while (in.nextPacketTag() == PacketTags.EXPERIMENTAL_2) + { + in.readPacket(); + } + + TrustPacket subTrust = readOptionalTrustPacket(in); + List sigList = readSignaturesAndTrust(in); + + return new PGPSecretKey(sub, new PGPPublicKey(sub.getPublicKeyPacket(), subTrust, sigList, fingerPrintCalculator)); + } } From de6a515ca51ab04f9c62b80a952d4e4ed00cce5b Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Fri, 31 Jan 2014 15:19:59 +0000 Subject: [PATCH 7/9] create keys with minimal keyrings being constructed in between --- .../keychain/pgp/PgpConversionHelper.java | 22 +++++++++++++++++-- .../keychain/ui/EditKeyActivity.java | 9 ++++---- .../keychain/ui/widget/SectionView.java | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java index e406a142e..20d446824 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java @@ -80,9 +80,27 @@ public class PgpConversionHelper { * @return */ public static PGPSecretKey BytesToPGPSecretKey(byte[] keyBytes) { - PGPSecretKey key = BytesToPGPSecretKeyList(keyBytes).get(0); + PGPObjectFactory factory = new PGPObjectFactory(keyBytes); + Object obj = null; + try { + obj = factory.nextObject(); + } catch (IOException e) { + Log.e(Constants.TAG, "Error while converting to PGPSecretKey!", e); + } + PGPSecretKey secKey = null; + if(obj instanceof PGPSecretKey) { + if ((secKey = (PGPSecretKey)obj ) == null) { + Log.e(Constants.TAG, "No keys given!"); + } + } else if(obj instanceof PGPSecretKeyRing) { //master keys are sent as keyrings + PGPSecretKeyRing keyRing = null; + if ((keyRing = (PGPSecretKeyRing)obj) == null) { + Log.e(Constants.TAG, "No keys given!"); + } + secKey = keyRing.getSecretKey(); + } - return key; + return secKey; } /** diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 85c1177df..09334fe6d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -193,19 +193,18 @@ public class EditKeyActivity extends SherlockFragmentActivity { if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { // get new key from data bundle returned from service Bundle data = message.getData(); - PGPSecretKeyRing masterKey = (PGPSecretKey) PgpConversionHelper - .BytesToPGPKey(data + PGPSecretKey masterKey = (PGPSecretKey) PgpConversionHelper + .BytesToPGPSecretKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY)); PGPSecretKey subKey = (PGPSecretKey) PgpConversionHelper - .BytesToPGPKey(data + .BytesToPGPSecretKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY2)); // add master key - mKeys.add(maskterKey); + mKeys.add(masterKey); mKeysUsages.add(Id.choice.usage.sign_only); //TODO: get from key flags // add sub key - subIt.next(); // masterkey mKeys.add(subKey); mKeysUsages.add(Id.choice.usage.encrypt_only); //TODO: get from key flags diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 4c8a50c90..83661d140 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -324,7 +324,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor // get new key from data bundle returned from service Bundle data = message.getData(); PGPSecretKey newKey = (PGPSecretKey) PgpConversionHelper - .BytesToPGPKey(data + .BytesToPGPSecretKey(data .getByteArray(KeychainIntentService.RESULT_NEW_KEY)); // add view with new key From 3f0f3cca6afa65dba4ff5868e5112cce39e2dc94 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Sat, 1 Feb 2014 16:36:33 +0000 Subject: [PATCH 8/9] wrong types being created --- .../sufficientlysecure/keychain/ui/widget/SectionView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 83661d140..96e434e20 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -297,10 +297,10 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor PGPSecretKey masterKey = ((KeyEditor) mEditors.getChildAt(0)).getValue(); passPhrase = PassphraseCacheService .getCachedPassphrase(mActivity, masterKey.getKeyID()); - isMasterKey = true; + isMasterKey = false; } else { passPhrase = ""; - isMasterKey = false; + isMasterKey = true; } data.putBoolean(KeychainIntentService.GENERATE_KEY_MASTER_KEY, isMasterKey); data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passPhrase); From 65d328be14d5b77dc4b787960ae7eb398417acea Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Sat, 1 Feb 2014 17:28:56 +0000 Subject: [PATCH 9/9] make sure method is public --- .../main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java index 4805721a8..6df4c0c91 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java @@ -478,7 +478,7 @@ public class PGPSecretKeyRing return new PGPSecretKeyRing(keys, secRing.extraPubKeys); } - static PGPSecretKey readSubkey(BCPGInputStream in, KeyFingerPrintCalculator fingerPrintCalculator) + public static PGPSecretKey readSubkey(BCPGInputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException { SecretSubkeyPacket sub = (SecretSubkeyPacket)in.readPacket();