Keychain SecItemAdd 所需的权利不存在
Keychain SecItemAdd A required entitlement isn't present
我正在尝试将从 .mobileconfig 文件中提取的证书 (base64) 添加到共享钥匙串:$(TeamIdentifierPrefix)com.apple.networkextensionsharing,如 [NEHotspotEAPSettings][1]
中所述。我启用了钥匙串共享并向权利中添加了 $(TeamIdentifierPrefix)com.apple.networkextensionsharing 。
这就是我的配置文件在授权时的样子:
这就是我添加证书的方式
NSString *cert = @""Y2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290"
"IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMI...";
NSData *certData = [[NSData alloc] initWithBase64EncodedString:cert options:0];
SecCertificateRef certRef = SecCertificateCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)certData);
NSDictionary* addquery = @{ (id)kSecValueRef: (__bridge id)certRef,
(id)kSecClass: (id)kSecClassCertificate,
(id)kSecAttrAccessGroup: @"123XYZ.com.apple.networkextensionsharing";
};
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)addquery, NULL);
if (status != errSecSuccess) {
// Handle the error
}
我在将证书添加到钥匙串时遇到以下错误:
errSecMissingEntitlement = -34018, /* A required
entitlement isn't present. */
谁能帮我指出我哪里做错了?
要解决此问题,应使用自动添加权利的自动签名。无法在配置文件中添加权利
我正在尝试将从 .mobileconfig 文件中提取的证书 (base64) 添加到共享钥匙串:$(TeamIdentifierPrefix)com.apple.networkextensionsharing,如 [NEHotspotEAPSettings][1]
中所述。我启用了钥匙串共享并向权利中添加了 $(TeamIdentifierPrefix)com.apple.networkextensionsharing 。
这就是我的配置文件在授权时的样子:
这就是我添加证书的方式
NSString *cert = @""Y2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290"
"IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMI...";
NSData *certData = [[NSData alloc] initWithBase64EncodedString:cert options:0];
SecCertificateRef certRef = SecCertificateCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)certData);
NSDictionary* addquery = @{ (id)kSecValueRef: (__bridge id)certRef,
(id)kSecClass: (id)kSecClassCertificate,
(id)kSecAttrAccessGroup: @"123XYZ.com.apple.networkextensionsharing";
};
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)addquery, NULL);
if (status != errSecSuccess) {
// Handle the error
}
我在将证书添加到钥匙串时遇到以下错误:
errSecMissingEntitlement = -34018, /* A required entitlement isn't present. */
谁能帮我指出我哪里做错了?
要解决此问题,应使用自动添加权利的自动签名。无法在配置文件中添加权利