mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
fix missing userIds in ImportKeysListEntry
This commit is contained in:
parent
97af8b2a01
commit
4a6aaf1e83
@ -229,8 +229,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ImportKeysListEntry(Context context, UncachedKeyRing ring) {
|
||||
// TODO less bouncy castle objects!
|
||||
|
||||
// save actual key object into entry, used to import it later
|
||||
try {
|
||||
this.mBytes = ring.getEncoded();
|
||||
@ -245,6 +243,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
||||
UncachedPublicKey key = ring.getPublicKey();
|
||||
|
||||
mPrimaryUserId = key.getPrimaryUserId();
|
||||
userIds = key.getUnorderedUserIds();
|
||||
|
||||
// if there was no user id flagged as primary, use the first one
|
||||
if (mPrimaryUserId == null) {
|
||||
|
@ -71,9 +71,7 @@ public class UncachedPublicKey {
|
||||
}
|
||||
|
||||
public String getPrimaryUserId() {
|
||||
List<String> userIds = new ArrayList<String>();
|
||||
for (String userId : new IterableIterator<String>(mPublicKey.getUserIDs())) {
|
||||
userIds.add(userId);
|
||||
for (PGPSignature sig : new IterableIterator<PGPSignature>(mPublicKey.getSignaturesForID(userId))) {
|
||||
if (sig.getHashedSubPackets() != null
|
||||
&& sig.getHashedSubPackets().hasSubpacket(SignatureSubpacketTags.PRIMARY_USER_ID)) {
|
||||
@ -94,6 +92,14 @@ public class UncachedPublicKey {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<String> getUnorderedUserIds() {
|
||||
ArrayList<String> userIds = new ArrayList<String>();
|
||||
for (String userId : new IterableIterator<String>(mPublicKey.getUserIDs())) {
|
||||
userIds.add(userId);
|
||||
}
|
||||
return userIds;
|
||||
}
|
||||
|
||||
public boolean isElGamalEncrypt() {
|
||||
return getAlgorithm() == PGPPublicKey.ELGAMAL_ENCRYPT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user