Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
nsPK11Token Class Reference

#include <nsPK11TokenDB.h>

Inheritance diagram for nsPK11Token:
Inheritance graph
[legend]
Collaboration diagram for nsPK11Token:
Collaboration graph
[legend]

List of all members.

Public Types

enum  CalledFromType { calledFromList, calledFromObject }

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIPK11TOKEN 
nsPK11Token (PK11SlotInfo *slot)
virtual ~nsPK11Token ()
boolean isLoggedIn ()
void login (in boolean force)
void logoutSimple ()
void logoutAndDropAuthenticatedResources ()
void reset ()
boolean checkPassword (in wstring password)
void initPassword (in wstring initialPassword)
void changePassword (in wstring oldPassword, in wstring newPassword)
long getAskPasswordTimes ()
long getAskPasswordTimeout ()
void setAskPasswordDefaults ([const ] in long askTimes,[const ] in long timeout)
boolean isHardwareToken ()
boolean needsLogin ()
boolean isFriendly ()
void shutdown (CalledFromType calledFrom)
PRBool isAlreadyShutDown ()

Public Attributes

const long ASK_EVERY_TIME = -1
const long ASK_FIRST_TIME = 0
const long ASK_EXPIRE_TIME = 1
readonly attribute wstring tokenName
readonly attribute wstring tokenLabel
readonly attribute wstring tokenManID
readonly attribute wstring tokenHWVersion
readonly attribute wstring tokenFWVersion
readonly attribute wstring tokenSerialNumber
readonly attribute long minimumPasswordLength
readonly attribute boolean needsUserInit

Private Member Functions

void refreshTokenInfo ()
virtual void virtualDestroyNSSReference ()
void destructorSafeDestroyNSSReference ()

Private Attributes

nsString mTokenName
nsString mTokenLabel
nsString mTokenManID
nsString mTokenHWVersion
nsString mTokenFWVersion
nsString mTokenSerialNum
PK11SlotInfo * mSlot
int mSeries
nsCOMPtr< nsIInterfaceRequestormUIContext

Friends

class nsPK11TokenDB

Detailed Description

Definition at line 53 of file nsPK11TokenDB.h.


Member Enumeration Documentation

Enumerator:
calledFromList 
calledFromObject 

Definition at line 270 of file nsNSSShutDown.h.


Constructor & Destructor Documentation

nsPK11Token::nsPK11Token ( PK11SlotInfo *  slot)

Definition at line 56 of file nsPK11TokenDB.cpp.

Here is the call graph for this function:

Definition at line 116 of file nsPK11TokenDB.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsIPK11Token::changePassword ( in wstring  oldPassword,
in wstring  newPassword 
) [inherited]
boolean nsIPK11Token::checkPassword ( in wstring  password) [inherited]

Definition at line 131 of file nsPK11TokenDB.cpp.

{
  if (isAlreadyShutDown())
    return;

  if (mSlot) {
    PK11_FreeSlot(mSlot);
    mSlot = nsnull;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIPK11Token::initPassword ( in wstring  initialPassword) [inherited]

Definition at line 298 of file nsNSSShutDown.h.

{ return mAlreadyShutDown; }

Here is the caller graph for this function:

void nsIPK11Token::login ( in boolean  force) [inherited]

Definition at line 71 of file nsPK11TokenDB.cpp.

{
  mTokenName = NS_ConvertUTF8toUTF16(PK11_GetTokenName(mSlot));

  SECStatus srv;

  CK_TOKEN_INFO tok_info;
  srv = PK11_GetTokenInfo(mSlot, &tok_info);
  if (srv == SECSuccess) {
    // Set the Label field

    const char *ccLabel = (const char*)tok_info.label;
    const nsACString &cLabel = Substring(
      ccLabel, 
      ccLabel+PL_strnlen(ccLabel, sizeof(tok_info.label)));
    mTokenLabel = NS_ConvertUTF8toUCS2(cLabel);
    mTokenLabel.Trim(" ", PR_FALSE, PR_TRUE);

    // Set the Manufacturer field
    const char *ccManID = (const char*)tok_info.manufacturerID;
    const nsACString &cManID = Substring(
      ccManID, 
      ccManID+PL_strnlen(ccManID, sizeof(tok_info.manufacturerID)));
    mTokenManID = NS_ConvertUTF8toUCS2(cManID);
    mTokenManID.Trim(" ", PR_FALSE, PR_TRUE);

    // Set the Hardware Version field
    mTokenHWVersion.AppendInt(tok_info.hardwareVersion.major);
    mTokenHWVersion.AppendLiteral(".");
    mTokenHWVersion.AppendInt(tok_info.hardwareVersion.minor);
    // Set the Firmware Version field
    mTokenFWVersion.AppendInt(tok_info.firmwareVersion.major);
    mTokenFWVersion.AppendLiteral(".");
    mTokenFWVersion.AppendInt(tok_info.firmwareVersion.minor);
    // Set the Serial Number field
    const char *ccSerial = (const char*)tok_info.serialNumber;
    const nsACString &cSerial = Substring(
      ccSerial, 
      ccSerial+PL_strnlen(ccSerial, sizeof(tok_info.serialNumber)));
    mTokenSerialNum = NS_ConvertUTF8toUCS2(cSerial);
    mTokenSerialNum.Trim(" ", PR_FALSE, PR_TRUE);
  }

}

Here is the call graph for this function:

void nsIPK11Token::reset ( ) [inherited]
void nsIPK11Token::setAskPasswordDefaults ( [const ] in long  askTimes,
[const ] in long  timeout 
) [inherited]
void nsNSSShutDownObject::shutdown ( CalledFromType  calledFrom) [inline, inherited]

Definition at line 285 of file nsNSSShutDown.h.

  {
    if (!mAlreadyShutDown) {
      if (calledFromObject == calledFrom) {
        nsNSSShutDownList::forget(this);
      }
      if (calledFromList == calledFrom) {
        virtualDestroyNSSReference();
      }
      mAlreadyShutDown = PR_TRUE;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsNSSShutDownObject.

Definition at line 126 of file nsPK11TokenDB.cpp.

Here is the call graph for this function:


Friends And Related Function Documentation

friend class nsPK11TokenDB [friend]

Definition at line 65 of file nsPK11TokenDB.h.


Member Data Documentation

Definition at line 45 of file nsIPK11Token.idl.

Definition at line 47 of file nsIPK11Token.idl.

Definition at line 46 of file nsIPK11Token.idl.

Definition at line 76 of file nsIPK11Token.idl.

Definition at line 72 of file nsPK11TokenDB.h.

PK11SlotInfo* nsPK11Token::mSlot [private]

Definition at line 71 of file nsPK11TokenDB.h.

Definition at line 69 of file nsPK11TokenDB.h.

Definition at line 69 of file nsPK11TokenDB.h.

Definition at line 69 of file nsPK11TokenDB.h.

Definition at line 69 of file nsPK11TokenDB.h.

Definition at line 68 of file nsPK11TokenDB.h.

Definition at line 70 of file nsPK11TokenDB.h.

Definition at line 73 of file nsPK11TokenDB.h.

Definition at line 77 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenFWVersion [inherited]

Definition at line 57 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenHWVersion [inherited]

Definition at line 56 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenLabel [inherited]

Definition at line 54 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenManID [inherited]

Definition at line 55 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenName [inherited]

Definition at line 52 of file nsIPK11Token.idl.

readonly attribute wstring nsIPK11Token::tokenSerialNumber [inherited]

Definition at line 58 of file nsIPK11Token.idl.


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