- SECCFFUNCTIONS(KeyItem, SecKeyRef, errSecInvalidItemRef, gTypes().KeyItem)
+ SECCFFUNCTIONS_BASE(KeyItem, SecKeyRef)
+
+ // SecKeyRef is now provided by iOS implementation, so we have to hack standard accessors normally defined by
+ // SECCFUNCTIONS macro to retarget SecKeyRef to foreign object instead of normal way through SecCFObject.
+ static KeyItem *required(SecKeyRef ptr);
+ static KeyItem *optional(SecKeyRef ptr);
+ operator CFTypeRef() const throw();
+ static SecCFObject *fromSecKeyRef(CFTypeRef ref);
+ void attachSecKeyRef() const;
+ void initializeWithSecKeyRef(SecKeyRef ref);
+
+private:
+ // This weak backpointer to owning SecKeyRef instance (which is created by iOS SecKey code).
+ mutable SecKeyRef mWeakSecKeyRef;