mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Merge branch 'development' of github.com:open-keychain/open-keychain into development
This commit is contained in:
commit
8dddc82f69
@ -62,12 +62,19 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
/** An operation class which implements high level import and export
|
/** An operation class which implements high level import and export
|
||||||
* operations.
|
* operations.
|
||||||
*
|
*
|
||||||
* This class receivs a source and/or destination of keys as input and performs
|
* This class receives a source and/or destination of keys as input and performs
|
||||||
* all steps for this import or export.
|
* all steps for this import or export.
|
||||||
*
|
*
|
||||||
* For the import operation, the only valid source is an Iterator of
|
* For the import operation, the only valid source is an Iterator of
|
||||||
* ParcelableKeyRing, each of which must contain exactly a single keyring
|
* ParcelableKeyRing, each of which must contain either a single
|
||||||
* encoded as bytes.
|
* keyring encoded as bytes, or a unique reference to a keyring
|
||||||
|
* on keyservers and/or keybase.io.
|
||||||
|
* It is important to note that public keys should generally be imported before
|
||||||
|
* secret keys, because some implementations (notably Symantec PGP Desktop) do
|
||||||
|
* not include self certificates for user ids in the secret keyring. The import
|
||||||
|
* method here will generally import keyrings in the order given by the
|
||||||
|
* iterator. so this should be ensured beforehand.
|
||||||
|
* @see org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter#getSelectedEntries()
|
||||||
*
|
*
|
||||||
* For the export operation, the input consists of a set of key ids and
|
* For the export operation, the input consists of a set of key ids and
|
||||||
* either the name of a file or an output uri to write to.
|
* either the name of a file or an output uri to write to.
|
||||||
|
@ -165,10 +165,6 @@ public class UncachedKeyRing {
|
|||||||
// if there are no objects left from the last factory, create a new one
|
// if there are no objects left from the last factory, create a new one
|
||||||
if (mObjectFactory == null) {
|
if (mObjectFactory == null) {
|
||||||
InputStream in = PGPUtil.getDecoderStream(stream);
|
InputStream in = PGPUtil.getDecoderStream(stream);
|
||||||
if (!BufferedInputStream.class.isInstance(in)) {
|
|
||||||
in = new BufferedInputStream(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
mObjectFactory = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
|
mObjectFactory = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public void setData(List<ImportKeysListEntry> data) {
|
public void setData(List<ImportKeysListEntry> data) {
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.mData = data;
|
this.mData = data;
|
||||||
@ -89,16 +90,24 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This method returns a list of all selected entries, with public keys sorted
|
||||||
|
* before secret keys, see ImportExportOperation for specifics.
|
||||||
|
* @see org.sufficientlysecure.keychain.operations.ImportExportOperation
|
||||||
|
*/
|
||||||
public ArrayList<ImportKeysListEntry> getSelectedEntries() {
|
public ArrayList<ImportKeysListEntry> getSelectedEntries() {
|
||||||
ArrayList<ImportKeysListEntry> result = new ArrayList<ImportKeysListEntry>();
|
ArrayList<ImportKeysListEntry> result = new ArrayList<ImportKeysListEntry>();
|
||||||
|
ArrayList<ImportKeysListEntry> secrets = new ArrayList<ImportKeysListEntry>();
|
||||||
if (mData == null) {
|
if (mData == null) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
for (ImportKeysListEntry entry : mData) {
|
for (ImportKeysListEntry entry : mData) {
|
||||||
if (entry.isSelected()) {
|
if (entry.isSelected()) {
|
||||||
result.add(entry);
|
// add this entry to either the secret or the public list
|
||||||
|
(entry.isSecretKey() ? secrets : result).add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// add secret keys at the end of the list
|
||||||
|
result.addAll(secrets);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user