iOS VPN?????????ú????
???????????? ???????[ 2016/7/12 14:11:16 ] ?????????????????? ???ù???
????????VPN????????????£???Щ????о??о?????????VPN???????????и?????????????????б????????о???????????????????????????????????
????VPN???????????????????iOS 8?????NetworkExtension????
???????????
????1.????VPN??????????????е?????????????????iOS 8??????????
????2.Xcode?汾??????6.0???????
????3.?????????????????????У????????????????????????????????????
????????
????????????provisioning profiles?????????????????????????????????
?????????????????????????????????“Certificate?? IDs & Profiles”??
???????“Identifiers”->“App IDs”????????app???????id??????“Personal VPN”??????????
???????????provisioning profile????????provisioning profile??
????????
???????xcode?в????????“single view application project”????????????????λ?÷??????UIButton??????????????????С?
???????????????????????viewDidLoad:?????е????????????ó???????????VPN???????????????????????????????ι????????????NetworkExtension????????????????????????
????NetworkExtension.framework
???????????????????????????app?????????????????????????????????????????С?????????????????????С?
?????????????????????????????????????????ó????????????????????????????????????????????????????????????????????????棬δ?????????????????????á??????????????app???????????????????????????????VPN?????????????????????£?
????· ????APP????????
????· ?????????
????· ??????????
????????????????????κε??????????????????ó????????????
????NetworkExtension???????????????
????· NEVPNManager
????· NEVPNProtocol
????· NEVPNConnection
????NEVPNManager?????????????????????????????????楨????????????????????е?VPN???????ò???????????????
????????VPN????
???????NEVPNManager??????????????????????
????NEVPNManager *manager = [NEVPNManager sharedManager];
??????NEVPNManager???????????????????????????????loadFromPreferencesWithCompletionHandler:?????????
????[manager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
????// Put your codes here...
????}];
??????????????????а??????block?????block????????????????????block???????NSError???????????????????????????????????????????????????????
????????????????????????VPN???????iOS 8???????Э?飺IPSec??IKEv2.?????????????????????????????????IKEv2Э?顣???Э?鱻???????е??????????????????????????Windows phone??Linux?????????????Э??????????????????????Э?顣????????????Щ??????Э?????????????????????????IPSecЭ????????????????
NEVPNProtocolIPSec *p = [[NEVPNProtocolIPSec alloc] init];
p.username = @"[Your username]";
p.passwordReference = [VPN user password from keychain];
p.serverAddress = @"[Your server address]";
p.authenticationMethod = NEVPNIKEAuthenticationMethodSharedSecret;
p.sharedSecretReference = [VPN server shared secret from keychain];
p.localIdentifier = @"[VPN local identifier]";
p.remoteIdentifier = @"[VPN remote identifier]";
p.useExtendedAuthentication = YES;
p.disconnectOnSleep = NO;
??????????????????????????NEVPNProtocolIPSec??????????????NEVPNProtocol??NEVPNProtocol??????????????????????????Э?顣????????е???????????????????????????????????????????????????????????д?????????????????????????????????????????????????????????IP?????????????????URL??????????????????????iOS 8??????????????:
????· NEVPNIKEAuthenticationMethodNone?????????????????????
????· NEVPNIKEAuthenticationMethodCertificate???????????????????
????· NEVPNIKEAuthenticationMethodSharedSecret????ù???????????????
??????????????????????????á?????????????????????????????????????????????????????????????????????????????????????sharedSecretReference??????????????????identityData?????Identity data??PKCS12?????????VPN?????塣???????????????PKCS12??NSData??????
????p.identityData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"clientCert" ofType:@"p12"]];
???????????????????????????????????????????????????????????????IPSec????????????μ????????useExtendedAuthetication?????????????????????????????????????????????????????IKE?????????????????????????????IKE????????????????????disconnectOnSleep???????????????????豸????????????VPN???????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11