Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/SecurityInterface.framework |
Availability | Available in Mac OS X v10.3 and later |
Companion guide | |
Declared in | SFCertificateTrustPanel.h |
The SFCertificateTrustPanel
class opens a panel or sheet that lets the user edit the trust settings in any of the certificates in a certificate chain.
The following figure shows an example of a certificate trust panel.
You can use this class to enable a user to make trust decisions when one or more certificates required for an operation are invalid or cannot be verified.
To display a certificate in a panel or sheet without editable trust settings, use the SFCertificatePanel
class. To display certificates in a custom view, use the SFCertificateView
class.
– beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:message:
– runModalForTrust:message:
Returns a shared certificate trust panel object. If the object has not already been created, this method allocates and initializes the object first.
+ (SFCertificateTrustPanel *)sharedCertificateTrustPanel
Use this method if your application displays a single certificate trust panel or sheet at a time. If your application can display multiple certificate trust panels or sheets at once, you must allocate separate object instances (using the alloc
class method inherited from NSObject
) and initialize (using the init
instance method, also inherited from NSObject
) instead of using this class method.
SFCertificateTrustPanel.h
Displays a modal sheet that shows the results of a certificate trust evaluation and that allows the user to edit trust settings.
- (void)beginSheetForWindow:(NSWindow *)docWindow modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo trust:(SecTrustRef)trust message:(NSString *)message
The parent window to which the sheet is attached.
The delegate object in which the method specified in the didEndSelector
parameter is implemented.
A method selector for a delegate method called when the sheet has been dismissed. Implementation of this delegate method is optional.
A pointer to data that is passed to the delegate method. You can use this data pointer for any purpose you wish.
A trust management object. Use the SecTrustCreateWithCertificates
function (in Security/SecTrust.h) to create the trust management object.
A message string to display in the sheet.
The delegate method has the following signature:
-(void)createPanelDidEnd:(NSWindow *)sheet |
returnCode:(int)returnCode |
contextInfo:(void *)contextInfo |
The parameters for the delegate method are:
The window to which the sheet was attached.
The result code indicating which button the user clicked: either NSFileHandlingPanelOKButton
or NSFileHandlingPanelCancelButton
.
Client-defined contextual data that is passed in the contextInfo
parameter of the beginSheetForDirectory:...
method.
The delegate method may dismiss the keychain settings sheet itself; if it does not, the sheet is dismissed on return from the beginSheetForDirectory:...
method.
SecTrustCreateWithCertificates
(Security/SecTrust.h)SecTrustGetUserTrust
(Security/SecTrust.h)SecTrustGetResult
– runModalForTrust:message:
SFCertificateTrustPanel.h
Displays a modal panel that shows the results of a certificate trust evaluation and that allows the user to edit trust settings.
- (NSInt)runModalForTrust:(SecTrustRef)trust message:(NSString *)message
A trust management object. Use the SecTrustCreateWithCertificates
function (in Security/SecTrust.h) to create the trust management object.
A message string to display in the panel.
This method returns NSOKButton
if the default button is clicked, or NSCancelButton
if the alternate button is clicked.
The user can use this panel to edit trust decisions for the specified certificate or for any of the certificates in the certificate chain. The trust settings are saved when the user clicks the default button. Call SecTrustGetUserTrust
to o btain the user’s trust settings.
Note that changing the user trust settings does not affect the results of a trust evaluation. Therefore, the trust evaluation shown in the panel (such as “This certificate is not yet valid”) does not change, nor does the result of a call to SecTrustGetResult
. It is up to your application to determine how to handle the user’s trust decision.
SecTrustCreateWithCertificates
(Security/SecTrust.h)SecTrustGetUserTrust
(Security/SecTrust.h)SecTrustGetResult
(Security/SecTrust.h)– beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:message:
SFCertificateTrustPanel.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)