Creating signature with the private key from PKCS12 certificate in Token extension.

I want to create signature with the private key from PKCS12 certificate in Smart Card Token extension. (Mac OS)

I am importing certificate through SecPKCS12Import() API in my app which adds the key to keychain also.

Later when I try to pair identity with user it hangs on calling SecKeyIsAlgorithmSupported() API.

The trace from Activity Monitor Sample shows this:

Please suggest where I am doing wrong Or am I following whole process correctly. I tried to find some samples but couldn't.

Let me be precise.

In my token extension when I get a call to sign - (nullable NSData *)tokenSession:(TKTokenSession *)session signData:(NSData *)dataToSign and I call SecKeyCreateSignature() func to get signature it again calls above tokenSession function. Is this right behaviour?

Creating signature with the private key from PKCS12 certificate in Token extension.
 
 
Q