如何设置验证设置数据? VPN Mac OS编程

时间:2015-09-08 11:58:09

标签: objective-c xcode6 osx-yosemite vpn system-configuration

我正在使用此https://github.com/halo/macosvpn。代码成功运行并创建新网络,但它没有显示身份验证设置数据,即密码,例如共享密钥。

- (CFDictionaryRef) L2TPPPPConfig {
CFStringRef keys[4] = { NULL, NULL, NULL, NULL };
CFStringRef vals[4] = { NULL, NULL, NULL, NULL };
CFIndex count = 0;

keys[count] = kSCPropNetPPPCommRemoteAddress;
vals[count++] = (__bridge CFStringRef)self.endpoint;

keys[count] = kSCPropNetPPPAuthName;
vals[count++] = (__bridge CFStringRef)self.username;

keys[count] = kSCPropNetPPPAuthPassword;
vals[count++] = (__bridge CFStringRef)self.serviceID;

keys[count] = kSCPropNetPPPAuthPasswordEncryption;
vals[count++] = kSCValNetPPPAuthPasswordEncryptionKeychain;

return CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&vals, count, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

enter image description here

此外,服务器地址和帐户名称设置成功。我

1 个答案:

答案 0 :(得分:0)

这两行看起来很可疑:

keys[count] = kSCPropNetPPPAuthPassword;
vals[count++] = (__bridge CFStringRef)self.serviceID;

第二行不应该是:“self.password”?

serviceID与密码完全不同。