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

Special characters %% decrypting to only one % #16

Open
mateen001 opened this issue Aug 15, 2022 · 0 comments
Open

Special characters %% decrypting to only one % #16

mateen001 opened this issue Aug 15, 2022 · 0 comments

Comments

@mateen001
Copy link

Hi Team,

We use AWS KMS(Python) to encrypt the password and this library to decrypt the password.

When we try to decrypt the password, one Special character (%) is missing the password.

As shown in the below example: could you please check

Actual password = abc7Kq3&o&uz%%fI&2xyz
Decrypted password = abc7Kq3&o&uz%fI&2xyz

We use Python to encrypt and Decrypt, which is working fine:
Here are the two python functions to encrypt and decrypt.

def encrypt(self, key_alias, value):
kms_client = self.__kms_client()

response = kms_client.encrypt(
    KeyId=key_alias,
    Plaintext=str.encode(value),
)
return base64.b64encode(response['CiphertextBlob']).decode('utf-8')

def decrypt(self, encrypted_key: str) -> str:
kms_client = self.__kms_client()
base64_encrypted_key = base64.b64decode(encrypted_key)
decrypted_value: str = kms_client.decrypt(CiphertextBlob=base64_encrypted_key).get('Plaintext').decode('utf-8')
return decrypted_value

Regards
Abdul Mateen

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

No branches or pull requests

1 participant