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

wrong metadata for NSCredential credentialWithIdentity:certificates:persistence: #320

Closed
np5 opened this issue Jul 27, 2020 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@np5
Copy link

np5 commented Jul 27, 2020

This method has currently (6.2.2) the following metadata:

{'arguments': ({'_template': True, 'type': b'@'},
               {'_template': True, 'type': b':'},
               {'null_accepted': True, 'type': b'^{__SecIdentity=}'},
               {'_template': True, 'type': b'@'},
               {'_template': True, 'type': b'Q'}),
 'classmethod': True,
 'hidden': False,
 'retval': {'_template': True, 'type': b'@'}}

Calling it with a SecIdentityRef object as the first argument triggers the following error:

depythonifying 'pointer', got 'SecIdentityRef'

@ykrods
Copy link

ykrods commented Feb 23, 2021

I encountered the same error, and got following workaround.

import objc
from Security import (
    NSURLCredential,
    SecIdentityGetTypeID,
)
# Workaround for the error of `depythonifying 'pointer', got 'SecIdentityRef'`
objc.registerCFSignature("SecIdentityRef", b"^{__SecIdentity=}", SecIdentityGetTypeID())
objc.registerMetaDataForSelector(
    b'NSURLCredential',
    b'credentialWithIdentity:certificates:persistence:',
    {
        'arguments': {
            2: {'null_accepted': False, 'type': b'@'},
            3: {'_template': True, 'type': b'@'},
            4: {'_template': True, 'type': b'Q'},
        },
        'classmethod': True,
        'hidden': False,
        'retval': {'_template': True, 'type': b"@"}
    }
)

references:

@np5
Copy link
Author

np5 commented Feb 28, 2021

@ykrods Thanks a lot! It worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants