-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement merging of new key material when importing pubkeys #3083
Open
mlschroe
wants to merge
7
commits into
rpm-software-management:master
Choose a base branch
from
mlschroe:master
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4621abc
Fix error handling in rpmtsImportPubkey
mlschroe 0872648
Make subkeys available right away when a pubkey is imported
mlschroe 5926604
Split subkey initialization into its own function
mlschroe 2292bb2
Add rpmKeyringModify to change the keys of a keyring
mlschroe 8ac10de
Add a method to lookup a key from the keyring
mlschroe 885a3ab
Support pubkey merging in the keyring code
mlschroe 028d84b
Merge keys and update the database in rpmtsImportPubkey()
mlschroe File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Add rpmKeyringModify to change the keys of a keyring
This allows us to replace or delete keys from the keyring.
- Loading branch information
commit 2292bb23715074743a3264b4f9e89d8e1bd21f3e
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,16 @@ | |
extern "C" { | ||
#endif | ||
|
||
/** \ingroup rpmkeyring | ||
* Operation mode definitions for rpmKeyringModify | ||
*/ | ||
typedef enum rpmKeyringModifyMode_e { | ||
RPMKEYRING_ADD = 1, | ||
RPMKEYRING_REPLACE = 2, | ||
RPMKEYRING_DELETE = 3 | ||
} rpmKeyringModifyMode; | ||
|
||
|
||
/** \ingroup rpmkeyring | ||
* Create a new, empty keyring | ||
* @return new keyring handle | ||
|
@@ -101,6 +111,15 @@ char * rpmPubkeyBase64(rpmPubkey key); | |
*/ | ||
pgpDigParams rpmPubkeyPgpDigParams(rpmPubkey key); | ||
|
||
/** \ingroup rpmkeyring | ||
* Modify the keys in the keyring | ||
* @param key Pubkey | ||
* @param key pubkey handle | ||
* @param mode mode of operation | ||
* @return 0 on success, -1 on error, 1 if key already present (add) or not found (delete) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please make this comment a bit more verbose, please. I get the idea, but the semantics aren't entirely clear to me. |
||
*/ | ||
int rpmKeyringModify(rpmKeyring keyring, rpmPubkey key, rpmKeyringModifyMode mode); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain the semantics of these different operations. My feeling is that there are only two relevant operations:
ADD_OR_MERGE
andDELETE
. Does yourADD
fail if the certificate is already present? DoesREPLACE
do a merge or not (looking at the code, it doesn't appear to)? If it doesn't, why not? (What's the use case?) Doesn't not merging mean that you potentially lose old binding signatures? That seems problematic to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about if you do the merge in the keyring code or in the import code. I played with both options and then settled in doing the merge call in the import code and then replacing the old pubkey with the merged pubkey.
It's up to the merge code if it wants to keep all binding signatures. The rpmpgp_legacy merge code does not throw away any pgp package.