Provider
MODULE | DESCRIPTION |
---|---|
base |
|
kms |
|
CLASS | DESCRIPTION |
---|---|
BaseProvider |
The BaseProvider class serves as an abstract base class for data masking providers. |
BaseProvider ¶
BaseProvider(
json_serializer: Callable[..., str] = functools.partial(
json.dumps, ensure_ascii=False
),
json_deserializer: Callable[[str], Any] = json.loads,
)
The BaseProvider class serves as an abstract base class for data masking providers.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
METHOD | DESCRIPTION |
---|---|
decrypt |
Abstract method for decrypting data. Subclasses must implement this method. |
encrypt |
Abstract method for encrypting data. Subclasses must implement this method. |
erase |
This method irreversibly erases data. |
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
46 47 48 49 50 51 52 |
|
decrypt ¶
decrypt(
data,
provider_options: dict | None = None,
**encryption_context: str
) -> Any
Abstract method for decrypting data. Subclasses must implement this method.
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
60 61 62 63 64 |
|
encrypt ¶
encrypt(
data,
provider_options: dict | None = None,
**encryption_context: str
) -> str
Abstract method for encrypting data. Subclasses must implement this method.
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
54 55 56 57 58 |
|
erase ¶
erase(data, **kwargs) -> Iterable[str]
This method irreversibly erases data.
If the data to be erased is of type str
, dict
, or bytes
,
this method will return an erased string, i.e. "*".
If the data to be erased is of an iterable type like list
, tuple
,
or set
, this method will return a new object of the same type as the
input data but with each element replaced by the string "*".
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
base ¶
CLASS | DESCRIPTION |
---|---|
BaseProvider |
The BaseProvider class serves as an abstract base class for data masking providers. |
BaseProvider ¶
BaseProvider(
json_serializer: Callable[..., str] = functools.partial(
json.dumps, ensure_ascii=False
),
json_deserializer: Callable[[str], Any] = json.loads,
)
The BaseProvider class serves as an abstract base class for data masking providers.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
METHOD | DESCRIPTION |
---|---|
decrypt |
Abstract method for decrypting data. Subclasses must implement this method. |
encrypt |
Abstract method for encrypting data. Subclasses must implement this method. |
erase |
This method irreversibly erases data. |
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
46 47 48 49 50 51 52 |
|
decrypt ¶
decrypt(
data,
provider_options: dict | None = None,
**encryption_context: str
) -> Any
Abstract method for decrypting data. Subclasses must implement this method.
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
60 61 62 63 64 |
|
encrypt ¶
encrypt(
data,
provider_options: dict | None = None,
**encryption_context: str
) -> str
Abstract method for encrypting data. Subclasses must implement this method.
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
54 55 56 57 58 |
|
erase ¶
erase(data, **kwargs) -> Iterable[str]
This method irreversibly erases data.
If the data to be erased is of type str
, dict
, or bytes
,
this method will return an erased string, i.e. "*".
If the data to be erased is of an iterable type like list
, tuple
,
or set
, this method will return a new object of the same type as the
input data but with each element replaced by the string "*".
Source code in aws_lambda_powertools/utilities/data_masking/provider/base.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
kms ¶
MODULE | DESCRIPTION |
---|---|
aws_encryption_sdk |
|
CLASS | DESCRIPTION |
---|---|
AWSEncryptionSDKProvider |
The AWSEncryptionSDKProvider is used as a provider for the DataMasking class. |
AWSEncryptionSDKProvider ¶
AWSEncryptionSDKProvider(
keys: list[str],
key_provider=None,
local_cache_capacity: int = CACHE_CAPACITY,
max_cache_age_seconds: float = MAX_CACHE_AGE_SECONDS,
max_messages_encrypted: int = MAX_MESSAGES_ENCRYPTED,
max_bytes_encrypted: int = MAX_BYTES_ENCRYPTED,
json_serializer: Callable[..., str] = functools.partial(
json.dumps, ensure_ascii=False
),
json_deserializer: Callable[[str], Any] = json.loads,
)
Bases: BaseProvider
The AWSEncryptionSDKProvider is used as a provider for the DataMasking class.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Source code in aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
aws_encryption_sdk ¶
CLASS | DESCRIPTION |
---|---|
AWSEncryptionSDKProvider |
The AWSEncryptionSDKProvider is used as a provider for the DataMasking class. |
KMSKeyProvider |
The KMSKeyProvider is responsible for assembling an AWS Key Management Service (KMS) |
AWSEncryptionSDKProvider ¶
AWSEncryptionSDKProvider(
keys: list[str],
key_provider=None,
local_cache_capacity: int = CACHE_CAPACITY,
max_cache_age_seconds: float = MAX_CACHE_AGE_SECONDS,
max_messages_encrypted: int = MAX_MESSAGES_ENCRYPTED,
max_bytes_encrypted: int = MAX_BYTES_ENCRYPTED,
json_serializer: Callable[..., str] = functools.partial(
json.dumps, ensure_ascii=False
),
json_deserializer: Callable[[str], Any] = json.loads,
)
Bases: BaseProvider
The AWSEncryptionSDKProvider is used as a provider for the DataMasking class.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Source code in aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
KMSKeyProvider ¶
KMSKeyProvider(
keys: list[str],
json_serializer: Callable[..., str],
json_deserializer: Callable[[str], Any],
local_cache_capacity: int = CACHE_CAPACITY,
max_cache_age_seconds: float = MAX_CACHE_AGE_SECONDS,
max_messages_encrypted: int = MAX_MESSAGES_ENCRYPTED,
max_bytes_encrypted: int = MAX_BYTES_ENCRYPTED,
)
The KMSKeyProvider is responsible for assembling an AWS Key Management Service (KMS) client, a caching mechanism, and a keyring for secure key management and data encryption.
METHOD | DESCRIPTION |
---|---|
decrypt |
Decrypt data using AWSEncryptionSDKProvider. |
encrypt |
Encrypt data using the AWSEncryptionSDKProvider. |
Source code in aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
decrypt ¶
decrypt(
data: str,
provider_options: dict | None = None,
**encryption_context: str
) -> Any
Decrypt data using AWSEncryptionSDKProvider.
PARAMETER | DESCRIPTION |
---|---|
data
|
The encrypted data, as a base64-encoded string
TYPE:
|
provider_options
|
Additional options for the aws_encryption_sdk.EncryptionSDKClient
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ciphertext
|
The decrypted data in bytes
TYPE:
|
Source code in aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
encrypt ¶
encrypt(
data: Any,
provider_options: dict | None = None,
**encryption_context: str
) -> str
Encrypt data using the AWSEncryptionSDKProvider.
PARAMETER | DESCRIPTION |
---|---|
data
|
The data to be encrypted.
TYPE:
|
provider_options
|
Additional options for the aws_encryption_sdk.EncryptionSDKClient
TYPE:
|
**encryption_context
|
Additional keyword arguments collected into a dictionary.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ciphertext
|
The encrypted data, as a base64-encoded string.
TYPE:
|
Source code in aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|