Skip to content
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

refactoring Algorithm definition components into separate encryption, kdf, and authentication algorithm suites #36

Merged
merged 4 commits into from Jan 5, 2018

Conversation

mattsb42-aws
Copy link
Member

This is an idea I've been playing with to try and make the algorithm suites more comprehensible and less error-prone.

Status Quo

Each algorithm suite is composed of a large number of individual values that together form the complete algorithm suite specification.

Problem

These algorithm suite definitions are hard to understand, hard to debug, and easy to mess up.

Solution

Algorithm suites are not conceptually a grouping of a large number of primitives. They are a grouping of a small number of groupings of related values. Each of these groupings define characteristics of the overall algorithm suite.

I have separated these out into three sub-suites:

  1. Encryption : contains only those values that control the encryption behavior
  2. KDF : contains only those values that control the key derivation behavior
  3. Authentication : contains only those values that control the authentication behavior

Each algorithm suite is then defined as a combination of these three sub-suites.

This lets us move from each algorithm suites having 13 distinct characteristics with no innately relations to:

  • Three distinct encryption suites
  • Two distinct KDF suites
  • Three distinct authentication suites

Each algorithm suite now has four important values: algorithm ID, encryption suite, KDF suite, and authentication suite.

For legacy compatibility, when each algorithm suite is constructed, it still sets all of its expected attributes using the attributes of the sub-suites.

@mattsb42-aws mattsb42-aws requested review from SalusaSecondus and a team December 6, 2017 01:21
Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like this, but have a few minor notes.

  1. We aren't (and shouldn't) be changing the specification. Thus what you describe as the "legacy" interface really is the "official" interface and you're just making some (very nice) implementation changes to make life easier.
  2. Please ensure that it is clear that developers don't get to mix and match these sub-components as they see fit and only official AlgorithmSuites are supports and may be used.

self.authentication = authentication
self.allowed = allowed

# Encryption Suite Legacy Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

self.auth_key_len = self.encryption.auth_key_length
self.auth_len = self.tag_len = self.encryption.auth_length

# KDF Suite Legacy Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

@mattsb42-aws
Copy link
Member Author

Updated with requested docs/comments changes.

@SalusaSecondus SalusaSecondus merged commit f98382a into aws:master Jan 5, 2018
@mattsb42-aws mattsb42-aws deleted the algorithm-reorg branch January 5, 2018 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants