]> git.saurik.com Git - apple/security.git/blobdiff - keychain/SecureObjectSync/SOSAccountLog.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / SecureObjectSync / SOSAccountLog.m
diff --git a/keychain/SecureObjectSync/SOSAccountLog.m b/keychain/SecureObjectSync/SOSAccountLog.m
new file mode 100644 (file)
index 0000000..1eed707
--- /dev/null
@@ -0,0 +1,38 @@
+//
+//  SOSAccountLog.c
+//  sec
+//
+#include "keychain/SecureObjectSync/SOSAccountPriv.h"
+#include "SOSAccountLog.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <AssertMacros.h>
+#include "SOSAccountPriv.h"
+#include "SOSViews.h"
+#include <utilities/SecCFWrappers.h>
+#import <utilities/SecNSAdditions.h>
+#include <utilities/SecCoreCrypto.h>
+#include <utilities/SecBuffer.h>
+#include "keychain/SecureObjectSync/SOSPeerInfoDER.h"
+
+#include "keychain/SecureObjectSync/SOSTransport.h"
+#include "keychain/SecureObjectSync/SOSPeerInfoCollections.h"
+#include <os/state_private.h>
+
+// Keep these for later
+void SOSAccountLog(SOSAccount* account) {
+    NSString* hex = [[account encodedData: nil] asHexString];
+    if(!hex) return;
+    secdebug("accountLog", "Full contents: %@", hex);
+}
+
+SOSAccount* SOSAccountCreateFromStringRef(CFStringRef hexString) {
+    CFDataRef accountDER = CFDataCreateFromHexString(kCFAllocatorDefault, hexString);
+    if(!accountDER) return NULL;
+    SOSAccount* account = [SOSAccount accountFromData:(__bridge NSData*) accountDER
+                                              factory:NULL
+                                                error:nil];
+    CFReleaseNull(accountDER);
+    return account;
+}