CPKIFCredentialSelectorDlg Class Reference

#include <CredentialSelectorDlg.h>

Inheritance diagram for CPKIFCredentialSelectorDlg:

Inheritance graph
[legend]
Collaboration diagram for CPKIFCredentialSelectorDlg:

Collaboration graph
[legend]

List of all members.


Detailed Description

CPKIFCredentialSelectorDlg is a wxWidgets-derived dialog class for enabling users to select credentials via a visual interface. The class requires access to a mediator/colleague collection that implements the IPKIFCryptoKeyIDOperations interface. On Windows platforms, the dialog enables users to review the certificate associated with each credential.

The following sample code demonstrates how to use this class:

IPKIFMediator* m = MakeDefaultMediator(); csd.SetMediator(m); csd.SetKeyUsages(std::bitset<9>(DigitalSignature | NonRepudiation | KeyEncipherment)); if(wxID_OK == csd.ShowModal()) { CPKIFCredentialPtr cred = csd.GetSelectedCredential(); } FreeDefaultMediator(m);

TSP-enforcing: No

Definition at line 57 of file CredentialSelectorDlg.h.


Public Member Functions

 CPKIFCredentialSelectorDlg (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE)
 ~CPKIFCredentialSelectorDlg ()
wxButton * GetMoInfo ()
wxListBoxGetListOfCredentials ()
bool SetMediator (IPKIFMediatorPtr &m)
void SetKeyUsages (std::bitset< 9 > &ku)
CPKIFCredentialPtr GetSelectedCredential () const
void OnInitDialog (wxInitDialogEvent &event)

Constructor & Destructor Documentation

CPKIFCredentialSelectorDlg::CPKIFCredentialSelectorDlg ( wxWindow *  parent,
wxWindowID  id,
const wxString &  title,
const wxPoint &  position = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxDEFAULT_DIALOG_STYLE 
)

Interface: External

Dialog constructor

Returns:
None

Definition at line 53 of file CredentialSelector.cpp.

References PKIFCRYPTO::DigitalSignature, PKIFCRYPTO::KeyEncipherment, and PKIFCRYPTO::NonRepudiation.

CPKIFCredentialSelectorDlg::~CPKIFCredentialSelectorDlg (  ) 

Interface: External

Dialog destructor

Returns:
None

Definition at line 74 of file CredentialSelector.cpp.


Member Function Documentation

wxButton* CPKIFCredentialSelectorDlg::GetMoInfo (  )  [inline]

Definition at line 68 of file CredentialSelectorDlg.h.

Referenced by OnInitDialog().

wxListBox* CPKIFCredentialSelectorDlg::GetListOfCredentials (  )  [inline]

Definition at line 69 of file CredentialSelectorDlg.h.

Referenced by OnInitDialog().

bool CPKIFCredentialSelectorDlg::SetMediator ( IPKIFMediatorPtr m  ) 

Interface: External

SetMediator is used to specify the mediator object that is used to discover credentials when the dialog is displayed. The calling application must make sure the pointer passed to this function is valid when the dialog is displayed. The calling application is also responsible for freeing memory associated with this pointer.

The mediator/colleague set passed to the function must implement the IPKIFCryptoKeyIDOperations interface.

The pointer passed to this function replaces any previously specified value. If the pointer passed to this function is non-NULL and does not implement the IPKIFCryptoKeyIDOperations interface, the previously specified value will remain in effect. Passing NULL to this function clears previously specified values.

true is returned if the previously specified value was replaced. false is returned when a non-NULL pointer is passed and does not implement IPKIFCryptoKeyIDOperations.

Returns:
None
Parameters:
m  This parameter is used to pass a pointer to a mediator/colleague set used to discover available credentials

Definition at line 210 of file CredentialSelector.cpp.

void CPKIFCredentialSelectorDlg::SetKeyUsages ( std::bitset< 9 > &  ku  ) 

Interface: External

SetKeyUsages is used to limit the types of credentials that are displayed when the dialog is displayed based on the key usage value each certificate. The KeyUsage enumeration defined in PKIFCryptoConstants.h can be used. For example, the following code demostrates how to display only credentials that may be used for encryption purposes:

CPKIFCredentialSelectorDlg csd(NULL,-1,wxT("Select a credential")); csd.SetKeyUsages(std::bitset<9>(KeyEncipherment));

The following code demonstrates how to display only credentials that may be used for digital signatures or non-repudiation.

CPKIFCredentialSelectorDlg csd(NULL,-1,wxT("Select a credential")); csd.SetKeyUsages(std::bitset<9>(DigitalSignature | NonRepudiation));

By default, credentials with the following key usages are displayed:

DigitalSignature | NonRepudiation | KeyEncipherment

Returns:
None
Parameters:
ku  Bitset indicating the types of credentials to display. The KeyUsage enum values can be used.

Definition at line 250 of file CredentialSelector.cpp.

CPKIFCredentialPtr CPKIFCredentialSelectorDlg::GetSelectedCredential (  )  const

Interface: External

GetSelectedCredential returns a CPKIFCredentialPtr to the credential selected by the user. If no credential was selected, NULL is returned.

Returns:
None

Definition at line 265 of file CredentialSelector.cpp.

void CPKIFCredentialSelectorDlg::OnInitDialog ( wxInitDialogEvent &  event  ) 

Interface: External

OnInitDialog obtains a pointer to the IPKIFCryptoKeyIDOperations interface from the mediator passed to SetMediator and gets a list of credentials. The name of each credential is read and populated in the list box. The index of the item in the list box corresponds to the index in the vector of credentials obtained via the call to GetKeyList.

A mediator object must have been specified via a call to SetMediator prior to displaying the dialog. Otherwise, an error message is displayed to the user and the dialog is displayed with an empty credentials list.

On non-windows platforms the View Certificate button is disabled.

Returns:
None

Definition at line 287 of file CredentialSelector.cpp.

References IPKIFCryptoKeyIDOperations::GetKeyList(), GetListOfCredentials(), GetMoInfo(), and MakeDefaultMediator().


The documentation for this class was generated from the following files:

Generated on Mon Nov 15 11:20:06 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6