【问题标题】:Keychain SecItemAdd A required entitlement isn't presentKeychain SecItemAdd 所需的权利不存在
【发布时间】:2020-06-10 14:30:31
【问题描述】:

我正在尝试将从 .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, /* 必填项 权利不存在。 */

谁能帮我指出我哪里做错了?

【问题讨论】:

    标签: ios objective-c keychain


    【解决方案1】:

    要解决此问题,应使用自动添加权利的自动签名。无法在配置文件中添加权利

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-07
      • 2019-08-03
      相关资源
      最近更新 更多