WSCKey Class Reference
Inherits from | WSCKeychainItem : NSObject |
Declared in | WSCKey.h WSCKey.m |
Overview
The WSCKey
class is a subclass of WSCKeychainItem
representing a key that is stored in a keychain.
On the other hand, if the key represented by WSCKey
is not stored in a keychain,
passing it to methods of WaxSealCore returns errors.
Tasks
Attributes of a Key
-
keyData
property -
keyAlgorithm
property -
encryptAlgorithm
property -
keySizeInBits
property -
keyClass
property -
keyUsage
property -
effectiveDate
property -
expirationDate
property
Comparing Keys
Keychain Services Bridge
-
secKey
property -
+ keyWithSecKeyRef:
Properties
effectiveDate
The effective date of a key represented by receiver.
@property (retain, readonly) NSDate *effectiveDate
Return Value
nil
if a key doesn’t have an effective date.
Declared In
WSCKey.h
encryptAlgorithm
The encrypt algorithm of a key represented by receiver.
@property (assign, readonly) WSCKeyAlgorithmType encryptAlgorithm
Declared In
WSCKey.h
expirationDate
The expiration date of a key represented by receiver.
@property (retain, readonly) NSDate *expirationDate
Return Value
nil
if a key doesn’t have an expiration date.
Declared In
WSCKey.h
keyAlgorithm
The key algorithm of a key represented by receiver.
@property (assign, readonly) WSCKeyAlgorithmType keyAlgorithm
Declared In
WSCKey.h
keyClass
The type of a key represented by receiver.
@property (assign, readonly) WSCKeyClass keyClass
Declared In
WSCKey.h
keyData
The key data bytes of a key represented by receiver.
@property (retain, readonly) NSData *keyData
Declared In
WSCKey.h
keySizeInBits
The size in bits of a key represented by receiver.
@property (assign, readonly) NSUInteger keySizeInBits
Declared In
WSCKey.h
keyUsage
The usage of a key represented by receiver.
@property (assign, readonly) WSCKeyUsage keyUsage
Declared In
WSCKey.h
secKey
The reference of the SecKey
opaque object, which wrapped by WSCKey
object. (read-only)
@property (unsafe_unretained, readonly) SecKeyRef secKey
Discussion
If you are familiar with the underlying Certificate, Key, and Trust Services API, you can move freely back and forth between WaxSealCore framework and Certificate, Key, and Trust Services API with this property.
Declared In
WSCKey.h
Class Methods
keyWithSecKeyRef:
Creates and returns a WSCKey
object using the given reference to the instance of SecKey
opaque type.
+ (instancetype)keyWithSecKeyRef:(SecKeyRef)_SecKeyRef
Parameters
- _SecKeyRef
A reference to the instance of
SecKey
opaque type.
Return Value
A WSCKey
object initialized with the given reference to the instance of SecKey
opaque type.
Return nil
if _SecKeyRef is nil
or an error occured.
Discussion
If you are familiar with the underlying Certificate, Key, and Trust Services API, you can move freely back and forth between WaxSealCore framework and Certificate, Key, and Trust Services API with this class method.
Warning: This method is just used for bridge between WaxSealCore framework and Certificate, Key, and Trust Services API.
Instead of invoking this method, you should construct a WSCKey
object by invoking:
- publicKey property of
WSCCertificateItem
Declared In
WSCKey.h
Instance Methods
isEqualToKey:
Returns a BOOL
value that indicates whether a given key is equal to receiver.
- (BOOL)isEqualToKey:(WSCKey *)_AnotherKey
Parameters
- _AnotherKey
The key with which to compare the receiver.
Return Value
YES
if _AnotherKey is equivalent to receiver (if they have the same data bytes);
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
WSCKey.h