#define kSecTokenLoginDomain CFSTR("com.apple.security.tokenlogin")
-static CFStringRef cfDataToHex(CFDataRef bin)
+static CFStringRef CF_RETURNS_RETAINED cfDataToHex(CFDataRef bin)
{
size_t len = CFDataGetLength(bin) * 2;
CFMutableStringRef str = CFStringCreateMutable(NULL, len);
return errSecSuccess;
}
-OSStatus TokenLoginUpdateUnlockData(CFDictionaryRef context)
+OSStatus TokenLoginGetPin(CFDictionaryRef context, CFStringRef *pin)
+{
+ if (!pin || !context) {
+ return errSecParam;
+ }
+ *pin = getPin(context);
+
+ return errSecSuccess;
+}
+
+OSStatus TokenLoginUpdateUnlockData(CFDictionaryRef context, CFStringRef password)
{
if (!context) {
return errSecParam;
return result;
}
- return SecKeychainStoreUnlockKeyWithPubKeyHash(getPubKeyHash(context), getTokenId(context), getPubKeyHashWrap(context), loginKeychain, NULL);
+ return SecKeychainStoreUnlockKeyWithPubKeyHash(getPubKeyHash(context), getTokenId(context), getPubKeyHashWrap(context), loginKeychain, password);
}
OSStatus TokenLoginCreateLoginData(CFStringRef tokenId, CFDataRef pubKeyHash, CFDataRef pubKeyHashWrap, CFDataRef unlockKey, CFDataRef scBlob)