jaraco / keyring

MIT License
1.24k stars 152 forks source link

Can't store password on keychain with pyinstaller on MacOS Monterey #629

Closed c-rei closed 1 year ago

c-rei commented 1 year ago

It works fine when I use my source, but when I run my app compiled by pyinstalller , I got the error like below.

Error 1: Can't get password from keychain: (-25293, 'Security Auth Failure: make sure python is signed with codesign util') Error 2: Can't store password on keychain: (-67030, 'Security Auth Failure: make sure python is signed with codesign util')

My code just is to saving or get a password, like below.

keyring.set_password("my-pa02", "serial_number", key)
keyring.get_password("my-pa02", "serial_number")

Environment

Thanks any help.

Ruben-Kruepper commented 1 year ago

Did you sign your binaries with an Apple Developer key? The error message implies otherwise.

jaraco commented 1 year ago

It occurs to me that in a Pyinstaller case, it's not the Python executable that needs to be signed but the wrapper executable. I wonder if the error message should say "make sure the executable is signed with codesign util". Even better would be to emit the exact executable (though I'm not sure if that's possible).

@c-rei Have you tried using codesign to sign the executable produced by pyinstaller?

c-rei commented 1 year ago

Hi jaraco,

When I updated Pyinstaller, the executable is signed by default of Pyinstaller, so it worked. Thanks your advices.