iosobjective-chandshakensstream

How to generate certificate exception using NSStream during handshake


I am using NSStream to do the handshake as server, handshake is successful there is not issue. i get the client certificate and i validate and store it in to keychain.

Now problem is i want to throw exception and it has to be sent through the stream to external device if the certificate is not there in the key chain.

I have to throw the exception because external device implementation is like that only. Can any body help me how to throw exception if the certificate is not there in the keychain.


Solution

  • I got the reply from Apple. Apple says throwing certificate exception is not possible with NSStream. With NSStream we can only get the trust and validate the trust. If the trust fails then we have to disconnect the socket.

    if we have to throw the exception then we have to drop down to lower level where we can get to know every handshake message.

    Edit 1:- Throwing "Certificate exception" is not possible even with low level API also. We will get to know when the certificate is getting received form the client/server.