diff --git a/src/frameworks/Accounts/include/Accounts/Accounts_Private.h b/src/frameworks/Accounts/include/Accounts/Accounts_Private.h
new file mode 100644
index 000000000..1fc6418de
--- /dev/null
+++ b/src/frameworks/Accounts/include/Accounts/Accounts_Private.h
@@ -0,0 +1,25 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _ACCOUNTS_PRIVATE_H_
+#define _ACCOUNTS_PRIVATE_H_
+
+
+
+#endif // _ACCOUNTS_PRIVATE_H_
diff --git a/src/frameworks/CryptoTokenKit/include/ACMDefs.h b/src/frameworks/CryptoTokenKit/include/ACMDefs.h
index adeb299c0..2fc6c0af1 100644
--- a/src/frameworks/CryptoTokenKit/include/ACMDefs.h
+++ b/src/frameworks/CryptoTokenKit/include/ACMDefs.h
@@ -8,5 +8,7 @@
// these are guessed and not verified
#define kACMPolicyDeviceOwnerAuthentication "ACMPolicyDeviceOwnerAuthentication"
+#define kACMPassphrasePurposeGeneral "ACMPassphrasePurposeGeneral"
+#define kACMScopeContext "ACMScopeContext"
#endif
diff --git a/src/frameworks/CryptoTokenKit/include/ACMLib.h b/src/frameworks/CryptoTokenKit/include/ACMLib.h
new file mode 100644
index 000000000..f1c313206
--- /dev/null
+++ b/src/frameworks/CryptoTokenKit/include/ACMLib.h
@@ -0,0 +1,10 @@
+#ifndef _ACMLIB_H_
+#define _ACMLIB_H_
+
+#include
+#include
+
+// CF type
+typedef void* ACMContextRef;
+
+#endif // _ACMLIB_H_
diff --git a/src/frameworks/Network/CMakeLists.txt b/src/frameworks/Network/CMakeLists.txt
index dbf2c63b9..6a0207415 100644
--- a/src/frameworks/Network/CMakeLists.txt
+++ b/src/frameworks/Network/CMakeLists.txt
@@ -109,3 +109,5 @@ add_framework(Network
objc
Foundation
)
+
+reexport(Network libnetwork ${CMAKE_BINARY_DIR}/src/external/libnetwork/libnetwork.dylib)
diff --git a/src/frameworks/Network/include/Network/Network.h b/src/frameworks/Network/include/Network/Network.h
index eeca0028d..f96f522e4 100644
--- a/src/frameworks/Network/include/Network/Network.h
+++ b/src/frameworks/Network/include/Network/Network.h
@@ -120,6 +120,8 @@
#import
#import
+#import
+
void* NWCreateDispatchDataFromNSData(void);
void* NWCreateNSDataFromDispatchData(void);
void* NWMonitorStatusToString(void);
diff --git a/src/frameworks/Network/include/Network/Network_Private.h b/src/frameworks/Network/include/Network/Network_Private.h
new file mode 100644
index 000000000..a24a85cfc
--- /dev/null
+++ b/src/frameworks/Network/include/Network/Network_Private.h
@@ -0,0 +1,27 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _NETWORK_NETWORK_PRIVATE_H_
+#define _NETWORK_NETWORK_PRIVATE_H_
+
+#include
+
+// nothing here yet
+
+#endif // _NETWORK_NETWORK_PRIVATE_H_
diff --git a/src/frameworks/SecurityFoundation/CMakeLists.txt b/src/frameworks/SecurityFoundation/CMakeLists.txt
index 869885aaf..7e86d2e69 100644
--- a/src/frameworks/SecurityFoundation/CMakeLists.txt
+++ b/src/frameworks/SecurityFoundation/CMakeLists.txt
@@ -169,6 +169,7 @@ add_framework(SecurityFoundation
src/SFCertificateData_ivars.m
src/SFCertificateData.m
src/SecFoundationModVector.m
+ src/SFKeychain.m
DEPENDENCIES
system
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/APIMacros.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/APIMacros.h
new file mode 100644
index 000000000..4b359e953
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/APIMacros.h
@@ -0,0 +1,25 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _SF_APIMACROS_H_
+#define _SF_APIMACROS_H_
+
+// nothing here yet
+
+#endif // _SF_APIMACROS_H_
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCertificateData.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCertificateData.h
index 622e75f0e..89c53739e 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCertificateData.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCertificateData.h
@@ -18,7 +18,12 @@
*/
#include
+#include
@interface SFCertificateData : NSObject
+- (instancetype)initWithCertificate:(SecCertificateRef)certificate;
+
+- (NSData*)tabDelimitedTextData;
+
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredentialStore_Private.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredentialStore_Private.h
new file mode 100644
index 000000000..348f15bfb
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredentialStore_Private.h
@@ -0,0 +1,27 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _SF_SFCREDENTIALSTORE_PRIVATE_H_
+#define _SF_SFCREDENTIALSTORE_PRIVATE_H_
+
+#import
+
+// nothing here yet
+
+#endif // _SF_SFCREDENTIALSTORE_PRIVATE_H_
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredential_Private.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredential_Private.h
new file mode 100644
index 000000000..b7fe80511
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCredential_Private.h
@@ -0,0 +1,27 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _SF_SFCREDENTIAL_PRIVATE_H_
+#define _SF_SFCREDENTIAL_PRIVATE_H_
+
+#import
+
+// nothing here yet
+
+#endif // _SF_SFCREDENTIAL_PRIVATE_H_
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCryptoServicesErrors.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCryptoServicesErrors.h
new file mode 100644
index 000000000..43b7ec8b6
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFCryptoServicesErrors.h
@@ -0,0 +1,20 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+// nothing here for now
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFEncryptionOperation.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFEncryptionOperation.h
new file mode 100644
index 000000000..f843154dd
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFEncryptionOperation.h
@@ -0,0 +1,22 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2019 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#import
+
+// not sure if this should just be a symlink or what
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey.h
index 3008a9269..db2a73164 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey.h
@@ -1,3 +1,22 @@
-// created for Darling
+/*
+ This file is part of Darling.
-@class SFECKeyPair;
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#import
+#import
+#import
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey_Private.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey_Private.h
new file mode 100644
index 000000000..e2c6fd508
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKey_Private.h
@@ -0,0 +1,22 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#import
+
+// nothing else here for now
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKeychain.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKeychain.h
new file mode 100644
index 000000000..13a428610
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFKeychain.h
@@ -0,0 +1,41 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#ifndef _SF_SFKEYCHAIN_H_
+#define _SF_SFKEYCHAIN_H_
+
+// not sure if this is the header that imports these
+// it could also be `SFCredential_Private.h` or `SFCredentialStore_Private.h`
+#import
+#import
+
+extern NSString* const SFKeychainErrorDomain;
+
+// not sure how these codes are supposed to be set up
+typedef NS_ENUM(NSInteger, SFKeychainError) {
+ // doesn't start at `-1` because that's usually for "unknown" errors
+ // these are guesses by the way
+ SFKeychainErrorInvalidParameter = -2,
+ SFKeychainErrorSaveFailed = -3,
+ SFKeychainErrorMissingAccessGroup = -4,
+ SFKeychainErrorInvalidPersistentIdentifier = -5,
+ SFKeychainErrorSecureDecodeFailed = -6,
+};
+
+#endif // _SF_SFKEYCHAIN_H_
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFSigningOperation.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFSigningOperation.h
index 59a9bfb70..41fbe31da 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFSigningOperation.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/SFSigningOperation.h
@@ -19,6 +19,10 @@
#include
+#import
+
@protocol SFSigningOperation
@end
+
+#import
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKey.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKey.h
index 514d1fba6..6834f65b0 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKey.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKey.h
@@ -19,6 +19,14 @@
#include
-@interface _SFAESKey : NSObject
+#import
+#import
+
+#define SFAESKey _SFAESKey
+
+@interface SFAESKey : SFKey
+
+- (instancetype)initRandomKeyWithSpecifier:(SFAESKeySpecifier*)specifier error:(NSError**)error;
+- (instancetype)initWithData:(NSData*)data specifier:(SFAESKeySpecifier*)specifier error:(NSError**)error;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKeySpecifier.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKeySpecifier.h
index f40c06d70..44552457b 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKeySpecifier.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAESKeySpecifier.h
@@ -19,6 +19,16 @@
#include
-@interface _SFAESKeySpecifier : NSObject
+#import
+
+#define SFAESKeySpecifier _SFAESKeySpecifier
+
+typedef NS_ENUM(NSInteger, SFAESKeyBitSize) {
+ SFAESKeyBitSize256,
+};
+
+@interface SFAESKeySpecifier : SFKeySpecifier
+
+- (instancetype)initWithBitSize:(SFAESKeyBitSize)bitSize;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAccessPolicy.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAccessPolicy.h
index b3eae5bd4..050a877f0 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAccessPolicy.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAccessPolicy.h
@@ -19,6 +19,26 @@
#include
-@interface _SFAccessPolicy : NSObject
+#define SFAccessPolicy _SFAccessPolicy
+
+typedef NS_ENUM(NSInteger, SFAccessible) {
+ SFAccessibleAfterFirstUnlock,
+};
+
+typedef NS_ENUM(NSInteger, SFSharingPolicy) {
+ SFSharingPolicyThisDeviceOnly,
+};
+
+// not sure what `accessibility` is
+// it's not a class, so i guess it's a structure?
+typedef struct SFAccessibilityStructure {
+ SFAccessible mode;
+} SFAccessibilityStructure;
+
+@interface SFAccessPolicy : NSObject
+
+@property (nonatomic) SFAccessibilityStructure accessibility;
+@property (nonatomic) SFSharingPolicy sharingPolicy;
+@property (copy, nonatomic) NSString* accessGroup;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedCiphertext.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedCiphertext.h
index aad193252..224d79df8 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedCiphertext.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedCiphertext.h
@@ -19,6 +19,10 @@
#include
-@interface _SFAuthenticatedCiphertext : NSObject
+#import
+
+#define SFAuthenticatedCiphertext _SFAuthenticatedCiphertext
+
+@interface SFAuthenticatedCiphertext : SFCiphertext
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedEncryptionOperation.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedEncryptionOperation.h
index 5d659f608..6130feb32 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedEncryptionOperation.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFAuthenticatedEncryptionOperation.h
@@ -19,6 +19,24 @@
#include
-@interface _SFAuthenticatedEncryptionOperation : NSObject
+#import
+#import
+#import
+#import
+
+#define SFAuthenticatedEncryptionOperation _SFAuthenticatedEncryptionOperation
+
+// i'm 90% sure this is AES-GCM
+
+@interface SFAuthenticatedEncryptionOperation : NSObject
+
+- (instancetype)initWithKeySpecifier:(SFAESKeySpecifier*)keySpecifier;
+
+- (SFAuthenticatedCiphertext*)encrypt:(NSData*)data withKey:(SFAESKey*)key error:(NSError**)error;
+- (SFAuthenticatedCiphertext*)encrypt:(NSData*)data withKey:(SFAESKey*)key additionalAuthenticatedData:(NSData*)aad error:(NSError**)error;
+
+// common sense tells me that the input parameter should be `SFAuthenticatedCiphertext*`,
+// but `SecDbKeychainItemV7.m` in Security says otherwise
+- (NSData*)decrypt:(NSData*)data withKey:(SFAESKey*)key error:(NSError**)error;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCiphertext.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCiphertext.h
index b847b4bff..a59e39cf0 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCiphertext.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCiphertext.h
@@ -19,6 +19,10 @@
#include
-@interface _SFCiphertext : NSObject
+#define SFCiphertext _SFCiphertext
+
+@interface SFCiphertext : NSObject
@end
+
+#import
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredential.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredential.h
index f93821e58..ad12f859b 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredential.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredential.h
@@ -19,6 +19,19 @@
#include
-@interface _SFCredential : NSObject
+#import
+
+#define SFCredential _SFCredential
+
+@interface SFCredential : NSObject
+
+@property (retain, nonatomic) SFServiceIdentifier* primaryServiceIdentifier;
+@property (retain, nonatomic) NSArray* supplementaryServiceIdentifiers;
+@property (copy, nonatomic) NSString* localizedLabel;
+@property (copy, nonatomic) NSString* localizedDescription;
+@property (copy, nonatomic) NSDictionary* customAttributes;
+@property (copy, nonatomic) NSDate* creationDate;
+@property (copy, nonatomic) NSDate* modificationDate;
+@property (copy, nonatomic) NSString* persistentIdentifier;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredentialStore.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredentialStore.h
index cd765a6da..7f2125f8c 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredentialStore.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFCredentialStore.h
@@ -19,6 +19,8 @@
#include
+#define SFCredentialStore _SFCredentialStore
+
@interface _SFCredentialStore : NSObject
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeyPair.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeyPair.h
index 23ad4d558..552ca711c 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeyPair.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeyPair.h
@@ -19,6 +19,17 @@
#include
-@interface _SFECKeyPair : NSObject
+#import
+#import
+#import
+
+#define SFECKeyPair _SFECKeyPair
+
+@interface SFECKeyPair : SFKeyPair
+
+- (instancetype)initWithData:(NSData*)data specifier:(SFECKeySpecifier*)keySpecifier error:(NSError**)error;
+- (instancetype)initRandomKeyPairWithSpecifier:(SFECKeySpecifier*)specifier;
+
+@property (readonly, copy, nonatomic) SFECPublicKey* publicKey;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeySpecifier.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeySpecifier.h
index 21b43878a..c726ac117 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeySpecifier.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECKeySpecifier.h
@@ -19,6 +19,16 @@
#include
-@interface _SFECKeySpecifier : NSObject
+#import
+
+typedef NS_ENUM(NSInteger, SFEllipticCurve) {
+ SFEllipticCurveNistp384,
+};
+
+@interface _SFECKeySpecifier : _SFKeySpecifier
+
+- (instancetype)initWithCurve:(SFEllipticCurve)curve;
@end
+
+#define SFECKeySpecifier _SFECKeySpecifier
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECPublicKey.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECPublicKey.h
index 1abe7ddcb..880491448 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECPublicKey.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFECPublicKey.h
@@ -19,6 +19,10 @@
#include
-@interface _SFECPublicKey : NSObject
+#import
+
+@interface _SFECPublicKey : SFPublicKey
@end
+
+#define SFECPublicKey _SFECPublicKey
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEC_X962SigningOperation.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEC_X962SigningOperation.h
index c9e7d5190..561bb875d 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEC_X962SigningOperation.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEC_X962SigningOperation.h
@@ -19,6 +19,17 @@
#include
-@interface _SFEC_X962SigningOperation : NSObject
+#import
+#import
+#import
+#import
+
+#define SFEC_X962SigningOperation _SFEC_X962SigningOperation
+
+@interface SFEC_X962SigningOperation : NSObject
+
+- (instancetype)initWithKeySpecifier:(SFECKeySpecifier*)keySpecifier;
+
+- (SFSignedData*)sign:(NSData*)data withKey:(SFECKeyPair*)key error:(NSError**)error;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEncryptionOperation.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEncryptionOperation.h
index 664d38e7a..ee49b0426 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEncryptionOperation.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFEncryptionOperation.h
@@ -19,6 +19,10 @@
#include
-@protocol _SFEncryptionOperation
+@protocol _SFEncryptionOperation
@end
+
+#define SFEncryptionOperation _SFEncryptionOperation
+
+#import
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKey.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKey.h
index 3a61c6bd8..e55a4634d 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKey.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKey.h
@@ -21,4 +21,8 @@
@interface _SFKey : NSObject
+@property (readonly, nonatomic) NSData* keyData;
+
@end
+
+#define SFKey _SFKey
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeyPair.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeyPair.h
index 3e7ec1b41..50a81b5b1 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeyPair.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeyPair.h
@@ -19,6 +19,12 @@
#include
-@interface _SFKeyPair : NSObject
+#import
+
+#define SFKeyPair _SFKeyPair
+
+@interface SFKeyPair : SFKey
@end
+
+#import
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeySpecifier.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeySpecifier.h
index 1e8b2eb49..53c8101c1 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeySpecifier.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFKeySpecifier.h
@@ -19,6 +19,8 @@
#include
-@interface _SFKeySpecifier : NSObject
+#define SFKeySpecifier _SFKeySpecifier
+
+@interface SFKeySpecifier : NSObject
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPasswordCredential.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPasswordCredential.h
index 30626cce7..f04be6677 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPasswordCredential.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPasswordCredential.h
@@ -19,6 +19,14 @@
#include
-@interface _SFPasswordCredential : NSObject
+#import
+#import
+
+#define SFPasswordCredential _SFPasswordCredential
+
+@interface SFPasswordCredential : SFCredential
+
+@property (copy, nonatomic) NSString* username;
+@property (copy, nonatomic) NSString* password;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPublicKey.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPublicKey.h
index 4f5fc356d..47838934e 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPublicKey.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFPublicKey.h
@@ -19,6 +19,10 @@
#include
-@interface _SFPublicKey : NSObject
+#import
+
+@interface _SFPublicKey : _SFKey
@end
+
+#define SFPublicKey _SFPublicKey
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFServiceIdentifier.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFServiceIdentifier.h
index 2aece07c8..eea2ccf6b 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFServiceIdentifier.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFServiceIdentifier.h
@@ -19,6 +19,11 @@
#include
-@interface _SFServiceIdentifier : NSObject
+#define SFServiceIdentifier _SFServiceIdentifier
+
+@interface SFServiceIdentifier : NSObject
+
+@property (readonly, copy, nonatomic) NSString* lookupKey;
+@property (readonly, copy, nonatomic) NSString* serviceID;
@end
diff --git a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFSignedData.h b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFSignedData.h
index d184be80c..1b9317990 100644
--- a/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFSignedData.h
+++ b/src/frameworks/SecurityFoundation/include/SecurityFoundation/_SFSignedData.h
@@ -22,3 +22,5 @@
@interface _SFSignedData : NSObject
@end
+
+#define SFSignedData _SFSignedData
diff --git a/src/frameworks/SecurityFoundation/src/SFKeychain.m b/src/frameworks/SecurityFoundation/src/SFKeychain.m
new file mode 100644
index 000000000..d510e461c
--- /dev/null
+++ b/src/frameworks/SecurityFoundation/src/SFKeychain.m
@@ -0,0 +1,3 @@
+#import
+
+NSString* const SFKeychainErrorDomain = @"SFKeychainErrorDomain";