mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 16:55:05 -05:00
Edit key: key flags
This commit is contained in:
parent
f8a222983e
commit
1455af2eed
@ -769,7 +769,7 @@ public class PgpKeyOperation {
|
||||
PGPSignatureSubpacketGenerator unhashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
||||
|
||||
// If this key can sign, we need a primary key binding signature
|
||||
if ((flags & KeyFlags.SIGN_DATA) != 0) {
|
||||
if ((flags & KeyFlags.SIGN_DATA) > 0) {
|
||||
// cross-certify signing keys
|
||||
PGPSignatureSubpacketGenerator subHashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
||||
subHashedPacketsGen.setSignatureCreationTime(false, todayDate);
|
||||
|
@ -407,7 +407,6 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
case EditSubkeyExpiryDialogFragment.MESSAGE_NEW_EXPIRY_DATE:
|
||||
Long expiry = (Long) message.getData().
|
||||
getSerializable(EditSubkeyExpiryDialogFragment.MESSAGE_DATA_EXPIRY_DATE);
|
||||
Log.d(Constants.TAG, "new expiry: " + expiry);
|
||||
mSaveKeyringParcel.getOrCreateSubkeyChange(keyId).mExpiry = expiry;
|
||||
break;
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
vCertifyIcon.setVisibility(cursor.getInt(INDEX_CAN_CERTIFY) != 0 ? View.VISIBLE : View.GONE);
|
||||
vEncryptIcon.setVisibility(cursor.getInt(INDEX_CAN_ENCRYPT) != 0 ? View.VISIBLE : View.GONE);
|
||||
vSignIcon.setVisibility(cursor.getInt(INDEX_CAN_SIGN) != 0 ? View.VISIBLE : View.GONE);
|
||||
// TODO: missing icon for authenticate
|
||||
|
||||
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
||||
|
||||
|
@ -28,6 +28,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
@ -56,7 +57,6 @@ public class SubkeysAddedAdapter extends ArrayAdapter<SaveKeyringParcel.SubkeyAd
|
||||
public ImageView vCertifyIcon;
|
||||
public ImageView vEncryptIcon;
|
||||
public ImageView vSignIcon;
|
||||
public ImageView vRevokedIcon;
|
||||
public ImageButton vDelete;
|
||||
// also hold a reference to the model item
|
||||
public SaveKeyringParcel.SubkeyAdd mModel;
|
||||
@ -73,13 +73,14 @@ public class SubkeysAddedAdapter extends ArrayAdapter<SaveKeyringParcel.SubkeyAd
|
||||
holder.vCertifyIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_certify);
|
||||
holder.vEncryptIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_encrypt);
|
||||
holder.vSignIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_sign);
|
||||
holder.vRevokedIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_revoked);
|
||||
holder.vDelete = (ImageButton) convertView.findViewById(R.id.subkey_item_delete_button);
|
||||
holder.vDelete.setVisibility(View.VISIBLE); // always visible
|
||||
|
||||
// not used:
|
||||
ImageView editImage = (ImageView) convertView.findViewById(R.id.subkey_item_edit_image);
|
||||
editImage.setVisibility(View.GONE);
|
||||
ImageView revokedIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_revoked);
|
||||
revokedIcon.setVisibility(View.GONE);
|
||||
|
||||
convertView.setTag(holder);
|
||||
|
||||
@ -115,14 +116,24 @@ public class SubkeysAddedAdapter extends ArrayAdapter<SaveKeyringParcel.SubkeyAd
|
||||
+ getContext().getString(R.string.none));
|
||||
}
|
||||
|
||||
// holder.mModel.mFlags
|
||||
|
||||
// Set icons according to properties
|
||||
// holder.vMasterIcon.setVisibility(cursor.getInt(INDEX_RANK) == 0 ? View.VISIBLE : View.INVISIBLE);
|
||||
// holder.vCertifyIcon.setVisibility(cursor.getInt(INDEX_CAN_CERTIFY) != 0 ? View.VISIBLE : View.GONE);
|
||||
// holder.vEncryptIcon.setVisibility(cursor.getInt(INDEX_CAN_ENCRYPT) != 0 ? View.VISIBLE : View.GONE);
|
||||
// holder.vSignIcon.setVisibility(cursor.getInt(INDEX_CAN_SIGN) != 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
int flags = holder.mModel.mFlags;
|
||||
if ((flags & KeyFlags.CERTIFY_OTHER) > 0) {
|
||||
holder.vCertifyIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.vCertifyIcon.setVisibility(View.GONE);
|
||||
}
|
||||
if ((flags & KeyFlags.SIGN_DATA) > 0) {
|
||||
holder.vSignIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.vSignIcon.setVisibility(View.GONE);
|
||||
}
|
||||
if (((flags & KeyFlags.ENCRYPT_COMMS) > 0)
|
||||
|| ((flags & KeyFlags.ENCRYPT_STORAGE) > 0)) {
|
||||
holder.vEncryptIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.vEncryptIcon.setVisibility(View.GONE);
|
||||
}
|
||||
// TODO: missing icon for authenticate
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -173,16 +173,16 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
|
||||
int flags = 0;
|
||||
if (mFlagCertify.isChecked()) {
|
||||
flags += KeyFlags.CERTIFY_OTHER;
|
||||
flags |= KeyFlags.CERTIFY_OTHER;
|
||||
}
|
||||
if (mFlagSign.isChecked()) {
|
||||
flags += KeyFlags.SIGN_DATA;
|
||||
flags |= KeyFlags.SIGN_DATA;
|
||||
}
|
||||
if (mFlagEncrypt.isChecked()) {
|
||||
flags += KeyFlags.ENCRYPT_COMMS + KeyFlags.ENCRYPT_STORAGE;
|
||||
flags |= KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE;
|
||||
}
|
||||
if (mFlagAuthenticate.isChecked()) {
|
||||
flags += KeyFlags.AUTHENTICATION;
|
||||
flags |= KeyFlags.AUTHENTICATION;
|
||||
}
|
||||
|
||||
Long expiry;
|
||||
|
@ -69,7 +69,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_action_edit"
|
||||
android:padding="8dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/user_id_item_delete_button"
|
||||
|
Loading…
Reference in New Issue
Block a user