I have the second:
My company bought VPN servers with iOS app for managing VPN connection to that servers. I need to write the same App for Android devices. I never worked with VPN connection on Android and at all.
In Swift code there’s some manipulations:
let prtcl = NEVPNProtocolIPSec()
prtcl.username = vpnAcc.vpnAcc
prtcl.passwordReference = keychainService.load(key: "password")
prtcl.serverAddress = vpnAcc.server
prtcl.remoteIdentifier = vpnAcc.remoteID
prtcl.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
prtcl.sharedSecretReference = keychainService.load(key: "shared")
prtcl.useExtendedAuthentication = true
prtcl.disconnectOnSleep = false
The VPN server has: IP, username, password, PSK (Pre-Shared Key) for establishing connection.
After googling in Apple’s docs about NEVPNProtocolIPSec I find out that this is the IPSec IKEv1 VPN connection.
First of all I tried use built-in VPN client on Android with different versions of devices (11, 10, and 7 OS versions). This client located in Settings-Network-VPN (on different devices it might be different). When I choose Add profile there’s some types of connection: PPTP, L2TP/IPSec PSK, L2TP/IPSec RSA, IPSec Xauth PSK,IPSec Xauth RSA, IPSec Hybrid RSA, IKEv2/IPSec MSCHAPv2, IKEv2/IPSec PSK, IKEv2/IPSec RSA.
So, I tried add a profile using IPSec Xauth PSK entering IP, username, password and PSK into corresponding fields but this not works, connection is not establishing. I also tried all that contains “PSK” in the name: L2TP/IPSec PSK and IKEv2/IPSec PSK. Also, there’s no result.
May be there some restrictions with IPSec in Android OS?
I googled many times, tried to build Strongswan library, but there’s no PSK support for IKEv1 connection.
Any ideas what can I do to establish VPN connection? May be my company have to upgrade servers to IKEv2? And after that upgrade how can I establish VPN connection programmatically?