Autenticación rápida de certificado de cliente iOS

El servicio web que quiero consumir requiere un certificado de cliente. ¿Cómo puedo enviarle mi certificado?

Para más detalles, no entiendo cómo crear elSecIdentityRef.

En miNSURLConnection didReceiveAuthenticationChallenge Tengo este condicional despuésServerTrust:

else if challenge?.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate
    {
        var secIdent : SecIdentityRef = ?????????
        var certCred = NSURLCredential(identity: secIdent, certificates: [getClientCertificate()], persistence: NSURLCredentialPersistence.Permanent)
        challenge?.sender.useCredential(certCred, forAuthenticationChallenge: challenge!)
    }

losgetClientCertificate método:

func getClientCertificate() -> SecCertificateRef
{
    let mainBundle : NSBundle = NSBundle.mainBundle()
    var mainBund = mainBundle.pathForResource("iosClientCert", ofType: "cer") //exported the cert in der format.
    var key : NSData = NSData(contentsOfFile: mainBund!)!
    var turnToCert : SecCertificateRef = SecCertificateCreateWithData(kCFAllocatorDefault, key).takeRetainedValue()

    return turnToCert;
}

Respuestas a la pregunta(4)

Su respuesta a la pregunta