Skip to content
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions python/example_code/kms/key_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def from_client(cls) -> "KeyEncrypt":
# snippet-end:[python.example_code.kms.KeyEncrypt.decl]

# snippet-start:[python.example_code.kms.Encrypt]
def encrypt(self, key_id: str, text: str) -> str:
def encrypt(self, key_id: str, text: str) -> bytes:
"""
Encrypts text by using the specified key.

Expand Down Expand Up @@ -64,7 +64,7 @@ def encrypt(self, key_id: str, text: str) -> str:
# snippet-end:[python.example_code.kms.Encrypt]

# snippet-start:[python.example_code.kms.Decrypt]
def decrypt(self, key_id: str, cipher_text: str) -> bytes:
def decrypt(self, key_id: str, cipher_text: bytes) -> str:
"""
Decrypts text previously encrypted with a key.

Expand All @@ -75,7 +75,7 @@ def decrypt(self, key_id: str, cipher_text: str) -> bytes:
try:
return self.kms_client.decrypt(KeyId=key_id, CiphertextBlob=cipher_text)[
"Plaintext"
]
].decode()
except ClientError as err:
logger.error(
"Couldn't decrypt your ciphertext. Here's why: %s",
Expand Down