簡體   English   中英

macOS 催化劑上鑰匙串項的 PersistentRef

[英]PersistentRef of keychain item on macOS catalyst

背景

我正在嘗試構建一個使用本機 IKEv2 實現連接到 VPN 的應用程序。 該應用程序應為 iOS 構建,但也應使用 Catalyst 平台在 macOS 上運行。

情況

在 iOS/macOS 中使用本機 IKEv2 實現連接到 VPN 時 - 要使用用戶名和密碼身份驗證,應用程序必須將持久的鑰匙串引用傳遞給包含密碼的鑰匙串項目。 參考

問題

在 iOS 上它工作得很好,但是在 Catalyst 平台上啟動 VPN 連接時,VPN 服務無法使用給定的持久引用檢索密碼。 控制台打印:

[] (null): Failed to copy content, SecKeychainItemCopyContent returned The contents of this item cannot be retrieved.

鑰匙串項存儲在鑰匙串中,持久引用不是nil ,但由於某種原因,操作系統的 VPN 服務無法檢索密碼。

如果我嘗試使用相同的持久引用檢索密碼 - 一切都按預期工作,並檢索密碼。

let query: [String: Any] = [
    kSecClass as String: kSecClassGenericPassword,
    kSecAttrPersistentReference as String: persistentRef,
    kSecReturnData as String: true
]
        
var item: CFTypeRef?
let status = SecItemCopyMatching(query as CFDictionary, &item)

任何信息將不勝感激。 也許在將密碼保存到鑰匙串時應該添加一些標志? 在專門在 Catalyst 平台上從鑰匙串檢索持久引用時,也許應該添加一些標志?

我直接通過蘋果的反饋支持問了這個問題,得到的答案是:

蘋果支持

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM