Mac Developer Library

Developer

SecurityInterface Framework Reference SFKeychainSavePanel Class Reference

Options
Deployment Target:

On This Page

SFKeychainSavePanel

The SFKeychainSavePanel class displays a sheet or panel that allows the user to create a keychain.

The following figure shows an example of a keychain save panel.

Figure 1Keychain save panel image: ../Art/keychain_save_panel.eps

Inheritance


Import Statement


Not Applicable

Objective-C

@import SecurityInterface;

Availability


Available in OS X v10.3 and later
  • Returns a shared keychain save panel object. If the object has not already been created, this method allocates and initializes the object first.

    Declaration

    Objective-C

    + (SFKeychainSavePanel *)sharedKeychainSavePanel

    Import Statement

    Objective-C

    @import SecurityInterface;

    Availability

    Available in OS X v10.3 and later.

  • Specifies the password for the keychain that will be created.

    Declaration

    Objective-C

    - (void)setPassword:(NSString *)password

    Parameters

    password

    The password to be used for the new keychain.

    Discussion

    This method is optional. If you don’t call this method, the keychain save panel displays a password-entry dialog.

    Import Statement

    Objective-C

    @import SecurityInterface;

    Availability

    Available in OS X v10.3 and later.

  • Displays a sheet that allows a user to create a new keychain.

    Declaration

    Objective-C

    - (void)beginSheetForDirectory:(NSString *)path file:(NSString *)name modalForWindow:(NSWindow *)docWindow modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo

    Parameters

    path

    The path to the folder where the keychain is created. Specify nil for ~/Library/Keychains.

    name

    The keychain name to be automatically displayed in the Save As field of the sheet.

    docWindow

    The parent window to which the sheet is attached. If this parameter is nil, the behavior defaults to a standalone modal window.

    delegate

    The delegate object in which the method specified in the didEndSelector parameter is implemented.

    didEndSelector

    A method selector for a delegate method called after the modal session has ended, but before the sheet has been dismissed. Implementation of this delegate method is optional.

    contextInfo

    A pointer to data that is passed to the delegate method. You can use this data pointer for any purpose you wish.

    Discussion

    The delegate method has the following signature:

    • -(void)createPanelDidEnd:(NSWindow *)sheet
    • returnCode:(int)returnCode
    • contextInfo:(void *)contextInfo

    The parameters for the delegate method are:

    sheet

    The window to which the sheet was attached.

    returnCode

    The result code indicating which button the user clicked: either NSFileHandlingPanelOKButton or NSFileHandlingPanelCancelButton.

    contextInfo

    Client-defined contextual data that is passed in the contextInfo parameter of the beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo: 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.

    Use the keychain method to obtain the keychain created by the user.

    Import Statement

    Objective-C

    @import SecurityInterface;

    Availability

    Available in OS X v10.3 and later.

  • Displays a panel that allows a user to create a new keychain.

    Declaration

    Objective-C

    - (NSInteger)runModalForDirectory:(NSString *)path file:(NSString *)name

    Parameters

    path

    The path to the folder where the keychain is created. Specify nil for ~/Library/Keychains.

    name

    The keychain name to be automatically displayed in the Save As field of the panel.

    Discussion

    This method returns a result code from the runModalForDirectory:file: method of the NSSavePanel class: NSFileHandlingPanelOKButton if the user clicks the OK button or NSFileHandlingPanelCancelButton if the user clicks the Cancel button.

    Use the keychain method to obtain the keychain created by the user.

    Import Statement

    Objective-C

    @import SecurityInterface;

    Availability

    Available in OS X v10.3 and later.