Skip to content

feat: remove specific value definition for keyring trace flags #215 #225

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

Merged
merged 5 commits into from
Mar 23, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/aws_encryption_sdk/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import struct
from enum import Enum

import attr
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec, padding, rsa
from cryptography.hazmat.primitives.ciphers import algorithms, modes
Expand Down Expand Up @@ -333,8 +334,14 @@ class ContentAADString(Enum):
class KeyringTraceFlag(Enum):
"""KeyRing Trace actions."""

WRAPPING_KEY_GENERATED_DATA_KEY = 1
WRAPPING_KEY_ENCRYPTED_DATA_KEY = 1 << 1
WRAPPING_KEY_DECRYPTED_DATA_KEY = 1 << 2
WRAPPING_KEY_SIGNED_ENC_CTX = 1 << 3
WRAPPING_KEY_VERIFIED_ENC_CTX = 1 << 4
@attr.s
class KeyringTraceFlagValue(object):
"""Keyring trace flags do not have defined serializable values."""

name = attr.ib()

WRAPPING_KEY_GENERATED_DATA_KEY = KeyringTraceFlagValue("WRAPPING_KEY_GENERATED_DATA_KEY")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these need to all start with "WRAPPING_KEY"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we went with that because that's what the prevailing naming was at the time (last summer). It looks like the names in the spec are now the simpler version. I'll update to use those names instead.

WRAPPING_KEY_ENCRYPTED_DATA_KEY = KeyringTraceFlagValue("WRAPPING_KEY_ENCRYPTED_DATA_KEY")
WRAPPING_KEY_DECRYPTED_DATA_KEY = KeyringTraceFlagValue("WRAPPING_KEY_DECRYPTED_DATA_KEY")
Copy link
Contributor

Choose a reason for hiding this comment

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

WRAPPING_KEY_SIGNED_ENC_CTX = KeyringTraceFlagValue("WRAPPING_KEY_SIGNED_ENC_CTX")
WRAPPING_KEY_VERIFIED_ENC_CTX = KeyringTraceFlagValue("WRAPPING_KEY_VERIFIED_ENC_CTX")
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason these need to be appreviated?

Copy link
Member Author

Choose a reason for hiding this comment

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

See reason for WRAPPING_KEY_ prefix.