-
Notifications
You must be signed in to change notification settings - Fork 50
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
Adds keyid_hash_algorithms to returned key objects #37
Merged
vladimir-v-diaz
merged 2 commits into
secure-systems-lab:master
from
lukpueh:update-import-keys
Jun 14, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -237,10 +237,11 @@ | |
keyval = KEYVAL_SCHEMA, | ||
expires = SCHEMA.Optional(ISO8601_DATETIME_SCHEMA)) | ||
|
||
# Like KEY_SCHEMA, but requires keyval's private portion to be not set or empty | ||
# Like ANYKEY_SCHEMA, but requires keyval's private portion to be not set or empty | ||
PUBLIC_KEY_SCHEMA = SCHEMA.Object( | ||
object_name = 'KEY_SCHEMA', | ||
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. Wrong object_name. Should be PUBLIC_KEY_SCHEMA. |
||
keytype = SCHEMA.AnyString(), | ||
keyid_hash_algorithms = SCHEMA.Optional(HASHALGORITHMS_SCHEMA), | ||
keyval = PUBLIC_KEYVAL_SCHEMA, | ||
expires = SCHEMA.Optional(ISO8601_DATETIME_SCHEMA)) | ||
|
||
|
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
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 |
---|---|---|
|
@@ -358,6 +358,11 @@ def generate_ecdsa_key(algorithm='ecdsa-sha2-nistp256'): | |
ecdsa_key['keyid'] = keyid | ||
ecdsa_key['keyval'] = key_value | ||
|
||
# Add "keyid_hash_algorithms" so equal ecdsa keys with | ||
# different keyids can be associated using supported keyid_hash_algorithms | ||
ecdsa_key['keyid_hash_algorithms'] = \ | ||
securesystemslib.settings.HASH_ALGORITHMS | ||
|
||
return ecdsa_key | ||
|
||
|
||
|
@@ -1245,6 +1250,11 @@ def import_rsakey_from_public_pem(pem): | |
rsakey_dict['keyid'] = keyid | ||
rsakey_dict['keyval'] = key_value | ||
|
||
# Add "keyid_hash_algorithms" so equal rsa keys with | ||
# different keyids can be associated using supported keyid_hash_algorithms | ||
rsakey_dict['keyid_hash_algorithms'] = \ | ||
securesystemslib.settings.HASH_ALGORITHMS | ||
|
||
return rsakey_dict | ||
|
||
|
||
|
@@ -1316,6 +1326,11 @@ def import_rsakey_from_pem(pem): | |
rsakey_dict['keyid'] = keyid | ||
rsakey_dict['keyval'] = key_value | ||
|
||
# Add "keyid_hash_algorithms" so equal ecdsa keys with | ||
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. This should be "so that equal RSA keys ..." |
||
# different keyids can be associated using supported keyid_hash_algorithms | ||
rsakey_dict['keyid_hash_algorithms'] = \ | ||
securesystemslib.settings.HASH_ALGORITHMS | ||
|
||
return rsakey_dict | ||
|
||
|
||
|
@@ -1894,6 +1909,11 @@ def import_ecdsakey_from_private_pem(pem, password=None): | |
ecdsakey_dict['keyid'] = keyid | ||
ecdsakey_dict['keyval'] = key_value | ||
|
||
# Add "keyid_hash_algorithms" so equal ecdsa keys with | ||
# different keyids can be associated using supported keyid_hash_algorithms | ||
ecdsakey_dict['keyid_hash_algorithms'] = \ | ||
securesystemslib.settings.HASH_ALGORITHMS | ||
|
||
return ecdsakey_dict | ||
|
||
|
||
|
@@ -1972,6 +1992,11 @@ def import_ecdsakey_from_public_pem(pem): | |
ecdsakey_dict['keyid'] = keyid | ||
ecdsakey_dict['keyval'] = key_value | ||
|
||
# Add "keyid_hash_algorithms" so equal ecdsa keys with | ||
# different keyids can be associated using supported keyid_hash_algorithms | ||
ecdsakey_dict['keyid_hash_algorithms'] = \ | ||
securesystemslib.settings.HASH_ALGORITHMS | ||
|
||
return ecdsakey_dict | ||
|
||
|
||
|
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.
NOTE: I don't see any major issues with this pull request, but I will make minor edits to your pull request for any minor issues. I will share my in-line comments on this pull request for documentation purposes.
This SCHEMA is more like KEY_SCHEMA, since ANYKEY_SCHEMA contains an attribute (keyid) that ANYKEY_SCHEMA doesn't. PUBLIC_KEY_SCHEMA matches KEY_SCHEMA, and will now differ with the
keyid_hash_algorithms
andkeyval
attributes.