-
Notifications
You must be signed in to change notification settings - Fork 6
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
utf-8 decode error #39
Comments
I'm having the same issue. (Adding some readability to the stacktrace)
|
I don't think it expects the value to be utf-8 encoded. The password gets encoded first, then later decoded, but there is an optional encryption logic. To me it looks more like it gets encoded and encrypted, but the decoder isn't aware of the AES key (yet), so it tries to decode without decrypting.
# secrethelper
@run_in_executor
def _encode_secret(self, password):
aes_iv = b""
password = password.encode("utf8")
if self.aes_key:
aes_iv = os.urandom(0x10)
padder = PKCS7(0x80).padder()
password = padder.update(password) + padder.finalize()
encryptor = Cipher(AES(self.aes_key), CBC(aes_iv), default_backend()).encryptor()
password = encryptor.update(password) + encryptor.finalize()
return [self.path, aes_iv, password, "text/plain"]
@run_in_executor
def _decode_secret(self, secret):
password = secret[2]
if self.aes_key:
aes_iv = bytes(secret[1])
decryptor = Cipher(AES(self.aes_key), CBC(aes_iv), default_backend()).decryptor()
password = decryptor.update(password) + decryptor.finalize()
unpadder = PKCS7(0x80).unpadder()
password = unpadder.update(password) + unpadder.finalize()
return bytearray(password).decode("utf8") |
This also happens to me while nextcloud tries to get the login credentials but the GPG key hasn't been unlocked yet. What should happen is GPG should open pinentry so we can unlock the key. |
Apparently pass_secret_service expects the field value to be utf-8 encoded and fails if not.
The text was updated successfully, but these errors were encountered: