Ich will ein kSecServerItem in den Schlüsselbund speichern. Bekomme allerdings die Meldung " / The attribute does not exist."
Sieht jemand den Fehler?
Alles anzeigen
Sieht jemand den Fehler?
C-Quellcode
- #include <stdio.h>
- #include <stdlib.h>
- #include <Carbon/Carbon.h>
- #include <Security/Security.h>
- int main(void)
- {
- SecKeychainItemRef item;
- SecKeychainAttributeList list;
- SecKeychainAttribute attrs[2];
- OSStatus err;
- char *server = "192.168.1.1";
- char *username = "hello";
- char *password = "world";
- attrs[0].tag = kSecServerItemAttr; // <--- das funktioniert nicht
- //attrs[0].tag = kSecDescriptionItemAttr; // <--- das funktioniert
- attrs[0].data = (void *)server;
- attrs[0].length = strlen(server);
- attrs[1].tag = kSecAccountItemAttr;
- attrs[1].data = (void *)username;
- attrs[1].length = strlen(username);
- list.count = 2;
- list.attr = attrs;
- err = SecKeychainItemCreateFromContent(kSecGenericPasswordItemClass,
- &list, strlen(password), password, NULL, NULL, &item);
- if(err != noErr)
- printf("%s\n", GetMacOSStatusCommentString(err));
- return 0;
- }
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Mactus ()