Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
nsSecretDecoderRing Class Reference

#include <nsSDR.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISECRETDECODERRING
NS_DECL_NSISECRETDECODERRINGCONFIG 
nsSecretDecoderRing ()
virtual ~nsSecretDecoderRing ()
long encrypt (in buffer data, in long dataLen, out buffer result)
long decrypt (in buffer data, in long dataLen, out buffer result)
string encryptString (in string text)
string decryptString (in string crypt)
void changePassword ()
void logout ()
void logoutAndTeardown ()
void setWindow (in nsISupports w)

Private Member Functions

nsresult encode (const unsigned char *data, PRInt32 dataLen, char **_retval)
 encode - encodes binary into BASE64 string.
nsresult decode (const char *data, unsigned char **result, PRInt32 *_retval)

Detailed Description

Definition at line 67 of file nsSDR.h.


Constructor & Destructor Documentation

Definition at line 126 of file nsSDR.cpp.

{
  // initialize superclass
}

Definition at line 132 of file nsSDR.cpp.

{
}

Member Function Documentation

nsresult nsSecretDecoderRing::decode ( const char *  data,
unsigned char **  result,
PRInt32 _retval 
) [private]

Definition at line 386 of file nsSDR.cpp.

{
    nsresult rv = NS_OK;
    PRUint32 len = PL_strlen(data);
    int adjust = 0;

    /* Compute length adjustment */
    if (data[len-1] == '=') {
      adjust++;
      if (data[len-2] == '=') adjust++;
    }

    *result = (unsigned char *)PL_Base64Decode(data, len, NULL);
    if (!*result) { rv = NS_ERROR_ILLEGAL_VALUE; goto loser; }

    *_retval = (len*3)/4 - adjust;

loser:
    return rv;
}

Here is the call graph for this function:

long nsISecretDecoderRing::decrypt ( in buffer  data,
in long  dataLen,
out buffer  result 
) [inherited]
nsresult nsSecretDecoderRing::encode ( const unsigned char *  data,
PRInt32  dataLen,
char **  _retval 
) [private]

encode - encodes binary into BASE64 string.

decode - decode BASE64 string into binary.

Definition at line 374 of file nsSDR.cpp.

{
    nsresult rv = NS_OK;

    *_retval = PL_Base64Encode((const char *)data, dataLen, NULL);
    if (!*_retval) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }

loser:
    return rv;
}

Here is the call graph for this function:

long nsISecretDecoderRing::encrypt ( in buffer  data,
in long  dataLen,
out buffer  result 
) [inherited]
void nsISecretDecoderRingConfig::setWindow ( in nsISupports  w) [inherited]

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