VPN not working on Mac Catalyst SecKeychainItemCopyContent returned The contents of this item cannot be retrieved
Asked Answered
V

0

10

I'm trying to run my VPN iOS application on Mac OS platform with Mac Catalyst.

My code is work on iOS applications but somehow it's not working on Mac OS.

VPN is not connect. But seems available in Network from System Preferences on Mac Catalina.

And also its contains our VPN connection informations such as server name, password. These all correct. In Keychain I would see psk and password. As far as I know psk is a shared secret key. But If I click to connect from network part I encounter with no shared secret key provided error. But actually its stored in keychain access.

My connection type is IPSec.

In Xcode After that clicked to connect VPN button I would see

Failed to copy content, SecKeychainItemCopyContent returned The contents of this item cannot be retrieved error< in console

I put that my connection part here.But to remind my code works without any mistake on iOS applications. Same code not works on Mac OS as well. Thats the problem.

Any help would be great!

public func connectIKEv2(config: Configuration, onError: @escaping (String)->Void) {
        let p = NEVPNProtocolIPSec()
        if config.pskEnabled {
            p.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
        } else {
            p.authenticationMethod = NEVPNIKEAuthenticationMethod.none
        }
        p.serverAddress = config.server
        p.disconnectOnSleep = false
        p.username = config.account
        p.passwordReference = config.getPasswordRef()
        p.sharedSecretReference = config.getPSKRef()
        // I catch password and psk without no mistake.
        p.useExtendedAuthentication = true

        // two lines bellow may depend of your server configuration
        p.remoteIdentifier = config.server
        //  p.localIdentifier = config.account

        loadProfile { _ in
            self.manager.protocolConfiguration = p
            if config.onDemand {
                self.manager.onDemandRules = [NEOnDemandRuleConnect()]
                self.manager.isOnDemandEnabled = true
            }
            self.manager.isEnabled = true
            self.saveProfile { success in
                if !success {
                    onError("Unable to save vpn profile")
                    return
                }
                self.loadProfile() { success in
                    if !success {
                        onError("Unable to load profile")
                        return
                    }
                    let result = self.startVPNTunnel()
                    if !result {
                        onError("Can't connect")
                    }
                }
            }
        }
    }
Vitellus answered 24/1, 2020 at 8:34 Comment(6)
did you solve the problem?Shackleton
@ZakharovRoman unfortunelty not, but I'm guessing that its not working with ikev2 I would suggest you to use openVPN protocol. All Mac Vpn app's use itVitellus
There is someone with similar problem : developer.apple.com/forums/thread/114767Thalamus
Yeah, this can't be fixed. Probably library not allowed to us using macOS platform. Just restricted with mobile platform.Thats why we have to set up openVPN connection.Vitellus
Having same problem, guys please let me know if anyone solved this issue.Griselgriselda
I've got the solution, I raised a query to Technical Support Incident (TSI). They gave me a demo. which works fine. I'm using NEVPNProtocolIPSecAdipose

© 2022 - 2024 — McMap. All rights reserved.