SFCertificateView Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/SecurityInterface.framework
Availability
Available in OS X v10.3 and later
Companion guide
Declared in
SFCertificateView.h

Overview

The SFCertificateView class displays the contents of a certificate. It includes options to display certificate details, display trust settings, and allow users to edit a certificate’s trust settings.

The following figure shows a certificate view that includes editable trust settings and certificate details.

Figure 1  Certificate view
Certificate view

Tasks

Specifying the Certificate to Display

Customizing the Appearance and Behavior of the View

Getting Information About the View

Saving User Trust Settings

Instance Methods

certificate

Returns the certificate currently displayed in the view.

- (SecCertificateRef)certificate
Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

detailsDisclosed

Returns whether the view currently shows the certificate’s details.

- (BOOL)detailsDisclosed
Discussion

The certificate details can be shown or hidden depending on whether the user clicks the disclosure triangle. This method returns the state of that disclosure triangle.

Availability
  • Available in OS X v10.5 and later.
Declared In
SFCertificateView.h

detailsDisplayed

Indicates if the view currently shows the certificate’s details.

- (BOOL)detailsDisplayed
Availability
  • Available in OS X v10.4 and later
Declared In
SFCertificateView.h

isEditable

Indicates if the view allows the user to edit the certificate’s trust.

- (BOOL)isEditable
Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

isTrustDisplayed

Indicates if the view currently shows the certificate’s trust settings.

- (BOOL)isTrustDisplayed
Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

policies

Returns an array of policies used to evaluate the status of the displayed certificate.

- (NSArray *)policies
Discussion

This method returns an autoreleased NSArray containing one or more instances of SecPolicyRef. The array always contains at least one item (the Apple X.509 Basic policy, if you have never called the setPolicies: method).

Availability
  • Available in OS X v10.4 and later
Declared In
SFCertificateView.h

policiesDisclosed

Returns whether the trust policy subview is disclosed.

- (BOOL)policiesDisclosed
Discussion

The trust policy settings can be shown or hidden depending on whether the user clicks the disclosure triangle. This method returns the state of that disclosure triangle.

Availability
  • Available in OS X v10.5 and later.
Declared In
SFCertificateView.h

saveTrustSettings

Saves the user’s current trust settings for the displayed certificate.

- (void)saveTrustSettings
Discussion

If trust settings are not editable, this method effectively does nothing. You can use SecTrustGetUserTrust to subsequently retrieve the trust settings.

Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

setCertificate:

Specifies the certificate that’s displayed in the view.

- (void)setCertificate:(SecCertificateRef)certificate
Parameters
certificate

The new certificate for the view.

Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

setDetailsDisclosed:

Sets whether the certificate details subview is disclosed.

- (void)setDetailsDisclosed:(BOOL)disclosed
Parameters
disclosed

Pass YES to open the disclosure triangle and disclose the view, or NO to close it and hide the view.

Discussion

The certificate details can be shown or hidden depending on whether the user clicks the disclosure triangle. This method sets the state of that disclosure triangle and the visibility of the corresponding view.

Availability
  • Available in OS X v10.5 and later.
Declared In
SFCertificateView.h

setDisplayDetails:

Specifies whether the user can see the certificate details.

- (void)setDisplayDetails:(BOOL)display
Parameters
display

Pass YES to display the certificate details, or NO to hide them.

Discussion

For behavioral compatibility with OS X v10.3, certificate details are displayed by default. To hide the details of a certificate, you must explicitly set the display value to NO.

Availability
  • Available in OS X v10.4 and later
Declared In
SFCertificateView.h

setDisplayTrust:

Specifies whether the user can see the certificate’s trust settings.

- (void)setDisplayTrust:(BOOL)display
Parameters
display

Pass YES to display the trust settings, or NO to hide them.

Discussion

Certificate trust settings are not displayed by default. To show the certificate’s trust settings, you must explicitly set the display value to YES. with either this method or the setEditableTrust method.

Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

setEditableTrust:

Specifies whether the user can edit the certificate’s trust settings.

- (void)setEditableTrust:(BOOL)editable
Parameters
editable

Pass YES if the trust settings should be editable.

Discussion

For behavioral compatibility with OS X v10.3, this method causes the certificate trust settings to be displayed if they are not currently visible (that is, if setDisplayTrust: is set to NO).

Availability
  • Available in OS X v10.3 and later.
Declared In
SFCertificateView.h

setPolicies:

Specifies the policies to use when evaluating this certificate’s status.

- (void)setPolicies:(id)policies
Parameters
policies

The policy or policies to use. You can pass either a SecPolicyRef object or an NSArray (containing one or more objects of type SecPolicyRef ) in this parameter. If policies is set to nil, the Apple X.509 Basic Policy is used. See “AppleX509TP Trust Policies” for a list of policies and object identifiers provided by the AppleX509TP module.

Discussion

Applications typically display a certificate view in the context of a specific use, such as SSL or S/MIME. You should set only the policy references that apply to your intended use.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
SFCertificateView.h

setPoliciesDisclosed:

Specifies whether the trust policy settings subview is disclosed.

- (void)setPoliciesDisclosed:(BOOL)disclosed
Parameters
disclosed

Pass YES to display the certificate details, or NO to hide them.

Discussion

The trust policy settings can be shown or hidden depending on whether the user clicks the disclosure triangle. This method sets the state of that disclosure triangle and the visibility of the corresponding view.

Availability
  • Available in OS X v10.5 and later.
Declared In
SFCertificateView.h

Constants

Notifications

Notifications sent by this class.

NSString *SFCertificateViewDisclosureStateDidChange;
Constants
SFCertificateViewDisclosureStateDidChange

Sent when the disclosure triangle is opened or closed.

Available in OS X v10.7 and later.

Declared in SFCertificateView.h.