Back to index

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

#include <nsCMSSecureMessage.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSICMSSECUREMESSAGE 
nsCMSSecureMessage ()
virtual ~nsCMSSecureMessage ()
string getCertByPrefID (in string certID)
 getCertByPrefID - a BASE64 string representing a user's certificate (or NULL if there isn't one)
nsIX509Cert decodeCert (in string value)
 decodeCert - decode a BASE64 string into an X509Certificate object
string sendMessage (in string msg, in string cert)
 sendMessage - send a text message to the recipient indicated by the base64-encoded cert.
string receiveMessage (in string msg)
 receiveMessage - recieve an encrypted (enveloped) message

Private Member Functions

NS_METHOD encode (const unsigned char *data, PRInt32 dataLen, char **_retval)
NS_METHOD decode (const char *data, unsigned char **result, PRInt32 *_retval)

Detailed Description

Definition at line 53 of file nsCMSSecureMessage.h.


Constructor & Destructor Documentation

Definition at line 77 of file nsCMSSecureMessage.cpp.

{
  // initialize superclass
}

Definition at line 83 of file nsCMSSecureMessage.cpp.

{
}

Member Function Documentation

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

Definition at line 361 of file nsCMSSecureMessage.cpp.

{
  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode\n"));
  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) {
    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode - error decoding base64\n"));
    rv = NS_ERROR_ILLEGAL_VALUE;
    goto loser;
  }

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

loser:
  return rv;
}

Here is the call graph for this function:

decodeCert - decode a BASE64 string into an X509Certificate object

nsresult nsCMSSecureMessage::encode ( const unsigned char *  data,
PRInt32  dataLen,
char **  _retval 
) [private]

Definition at line 349 of file nsCMSSecureMessage.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:

getCertByPrefID - a BASE64 string representing a user's certificate (or NULL if there isn't one)

receiveMessage - recieve an encrypted (enveloped) message

string nsICMSSecureMessage::sendMessage ( in string  msg,
in string  cert 
) [inherited]

sendMessage - send a text message to the recipient indicated by the base64-encoded cert.


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