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

Use a digest to generate a memory key #80

Merged
merged 1 commit into from
May 21, 2019

Conversation

justincampbell
Copy link
Contributor

The Ruby OpenSSL AES 128 cipher requires a 16-byte key. The previous implementation of #memory_key_for generated a base64 string and then truncated it to 16 bytes. This could cause longer paths/keys (and now contexts) to have the same memory key for different values.

This change uses an MD5 digest to generate a mostly-unique key for different key/path/context inputs.

@hashicorp-cla
Copy link

hashicorp-cla commented May 21, 2019

CLA assistant check
All committers have signed the CLA.

Copy link

@findkim findkim left a comment

Choose a reason for hiding this comment

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

The changes look good! (pending another typo fix)

If i'm following the changes correctly, does this only effect how in-memory keys are digested and so no need to worry about backward compatibility issues here since any application would have to restart to fetch these changes?

The Ruby OpenSSL AES 128 cipher requires a 16-byte key. The previous
implementation of #memory_key_for generated a base64 string and then
truncated it to 16 bytes. This could cause longer paths/keys (and now
contexts) to have the same memory key for different values.

This change uses an MD5 digest to generate a mostly-unique key for
different key/path/context inputs.
@justincampbell
Copy link
Contributor Author

@findkim Correct, this is only used in-memory for testing and development. We also plan on bumping the version as some method signatures changed in #78. Thanks!

@justincampbell justincampbell merged commit 7ca3d45 into master May 21, 2019
@justincampbell justincampbell deleted the use-digest-for-memory-key branch May 21, 2019 20:36
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

3 participants