joining enterprise wifi networks...

with Stefan’s help here http://macscripter.net/viewtopic.php?id=40307 I’m successfully listing and joining regular networks with the following code:

	
try
		set my WiFiStatusBox to "Connecting to " & WiFiNetwork
                tell theWindow to displayIfNeeded()
		set currentInterface to CWInterface's interface()
		set networks to currentInterface's scanForNetworksWithName_error_(WiFiNetwork, missing value)
                if networks's |count|() > 0 then
			set myNetwork to networks's anyObject()
			currentInterface's associateToNetwork_password_error_(myNetwork, WiFiPassword, missing value)
		end if
		set my WiFiStatusBox to "Congrats, now connected to " & WiFiNetwork
on error err
		log "joining wifi network error: " & err
end try

Where “WiFiNetwork” is a selected network (of type string) and WiFiPassword is also of type string

Anyway:

I’d like now to be able to join Enterprise networks using:

- (BOOL)associateToEnterpriseNetwork:(CWNetwork *)network identity:(SecIdentityRef)identity username:(NSString *)username password:(NSString *)password error:(NSError **)error ;

Very similar to the “associateToNetwork” method but: I can’t see how to return the “identity:(SecIdentityRef)identity”

It’s mentioned here: http://developer.apple.com/library/mac/#documentation/Security/Reference/certifkeytrustservices/Reference/reference.html#//apple_ref/doc/c_ref/SecIdentityRef

I already have the various certs installed in the system keychain

Just don’t know how to return a SecIdentityRef object

furthermore, SecIdentityRef is defined in SecBase.h as


typedef struct OpaqueSecIdentityRef *SecIdentityRef;

/*!
    @typedef SecKeyRef
    @abstract Contains information about a key.
*/

Oh well, that was easy!

currentInterface's associateToEnterpriseNetwork_identity_username_password_error_(myNetwork, missing value, WiFiUserName, WiFiPassword, missing value)