WSCTrustedApplication Class Reference
Inherits from | NSObject |
Declared in | WSCTrustedApplication.h WSCTrustedApplication.m |
Tasks
Properties
-
uniqueIdentification
property
Creating Trusted Application
Comparing Trusted Application
Keychain Services Bridge
Properties
secTrustedApplication
The reference of the secTrustedApplication
opaque object, which wrapped by WSCTrustedApplication
object.
@property (unsafe_unretained, readonly) SecTrustedApplicationRef secTrustedApplication
Discussion
If you are familiar with the underlying Keychain Services API, you can move freely back and forth between WaxSealCore framework and Keychain Services API with this property.
Declared In
WSCTrustedApplication.h
uniqueIdentification
Retrieves and sets the unique identification of the trusted application represented by receiver.
@property (retain, readwrite) NSData *uniqueIdentification
Discussion
The trusted application represented by receiver includes data that uniquely identifies the application (aka. unique identification), such as a cryptographic hash of the application. The operating system can use this data to verify that the application has not been altered since the trusted application object was created. When an application requests access to an item in the keychain for which it is designated as a trusted application, for example, the operating system checks this data before granting access. You can use the read property to extract this data from the trusted application object for storage or for transmittal to another location (such as over a network). Use the write property to insert the data back into a trusted application object.
Warning: Note that this data is in a private format; there is no supported way to read or interpret it.
Declared In
WSCTrustedApplication.h
Class Methods
trustedApplicationWithContentsOfURL:error:
Creates a trusted application object based on the application specified by an URL.
+ (instancetype)trustedApplicationWithContentsOfURL:(NSURL *)_ApplicationURL error:(NSError **)_Error
Parameters
- _ApplicationURL
The URL to the application or tool to trust. For application bundles, use the URL to the bundle directory. Pass
nil
to refer to the application or tool making this call.
- _Error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify
nil
for this parameter if you don’t want the error information.
Return Value
Newly created trusted application object. Returns nil
if an error occurs.
Discussion
This method creates a trusted application object,
which both identifies an application and provides data that can be used to ensure
that the application has not been altered since the object was created.
The trusted application object is used as input to the SecAccessCreate
function, which creates an access object.
The access object, in turn, is used as input to the SecKeychainItemSetAccess
function
to specify the set of applications that are trusted to access a specific keychain item.
Declared In
WSCTrustedApplication.h
trustedApplicationWithSecTrustedApplicationRef:
Creates and returns a WSCTrustedApplication
object using the given reference to the instance of SecTrustedApplication
opaque type.
+ (instancetype)trustedApplicationWithSecTrustedApplicationRef:(SecTrustedApplicationRef)_SecTrustedAppRef
Parameters
- _SecTrustedAppRef
A reference to the instance of
SecTrustedApplication
opaque type.
Return Value
A WSCTrustedApplication
object initialized with the givent reference to the instance of SecTrustedApplication
opaque type.
Return nil
if _SecTrustedAppRef is nil
.
Discussion
This method creates a trusted application object with the specified underlying SecTrustedApplicationRef
.
which both identifies an application and provides data that can be used to ensure
that the application has not been altered since the object was created.
The trusted application object is used as input to the SecAccessCreate
function, which creates an access object.
The access object, in turn, is used as input to the SecKeychainItemSetAccess
function
to specify the set of applications that are trusted to access a specific keychain item.
If you are familiar with the underlying Keychain Services API, you can move freely back and forth between WaxSealCore framework and Keychain Services API with this class method.
Warning: This method is just used for bridge between WaxSealCore framework and Keychain Services API.
Instead of invoking this method, you should construct a WSCTrustedApplication
object by invoking:
Declared In
WSCTrustedApplication.h
Instance Methods
isEqualToTrustedApplication:
Returns a BOOL
value that indicates whether a given trusted application is equal to receiver.
- (BOOL)isEqualToTrustedApplication:(WSCTrustedApplication *)_AnotherTrustedApplication
Parameters
- _AnotherTrustedApplication
The trusted application with which to compare the receiver.
Return Value
YES
if _AnotherTrustedApplication is equivalent to receiver (if they have the same unique identification);
otherwise NO.
One more thing
When you know both objects are keychains, this method is a faster way to check equality than method isEqual:
.
Declared In
WSCTrustedApplication.h