-
Notifications
You must be signed in to change notification settings - Fork 72
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
Extend macOS implementation of SqueakSSL plugin to support setting a certificate on the SSL session context #816
Extend macOS implementation of SqueakSSL plugin to support setting a certificate on the SSL session context #816
Conversation
…tate to ‘SQSSL_CONNECTED’, returned the value of ‘SQSSL_OK’ (zero) rather than the number of bytes written to the output buffer.
…ng been set (by searching for a valid identity with the property value as its subject through ‘SecItemCopyMatching’ and setting it as the SSL session context’s certificate through ‘SSLSetCertificate’).
a675a2b
to
28670bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me.
Would you mind checking my comment?
Also, tell me if you feel this is ready for integration.
@@ -626,7 +660,7 @@ sqInt sqAcceptSSL(sqInt handle, char* srcBuf, sqInt srcLen, char* dstBuf, | |||
} | |||
/* We are connected. Verify the cert. */ | |||
ssl->state = SQSSL_CONNECTED; | |||
return SQSSL_OK; | |||
return ssl->outLen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naive question: does this not break anything ? ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I know of.
Doing the following may help clarify this change: using the new version of the SqueakSSL plugin, put (#result -> result) inspect
before the assignment of false
to connecting
in #accept
on ZdcSecureSocketStream, then try my snippet for setting up a ZnSecureServer.
Assuming it works and you get a ZnResponse with status 200, you should also have gotten a value for result
greater than 0, so there was a send of #flushEncryptedBytes:startingAt:count:
in the last iteration of the #whileFalse:
loop. Without the change, result
would have been 0, meaning those bytes got lost.
It’s ready for integration yes. |
Thanks! |
This pull request extends the macOS implementation of the SqueakSSL plugin to support setting a certificate on the SSL session context. It differs from pull request #812 in that the ‘CERTNAME’ property is used to identify a certificate and private key in a keychain rather than as the path to a file containing the certificate and private key. Commit 539aedd in this pull request corresponds to commit 3d9d900 in the earlier pull request and fixes a bug in ‘sqAcceptSSL’.
This can be used to set up a ZnSecureServer on macOS as follows:
Browsing ‘https://localhost:1443’ works with Chrome and Firefox. As noted in the earlier pull request, with Safari, there’s a problem which seems to be related to the use of IPv4 rather than IPv6.
The earlier pull request was closed, and this new one opened, following comments given in OpenSmalltalk VM issue #680. As mentioned there, a concern now could be that there can be multiple certificates for the same subject, which one is then used is not really specified, except that expired certificates are excluded from the search performed through ‘SecItemCopyMatching’ by using ‘kSecMatchValidOnDate’ in the query.