ToolkitUtils_logging.cpp File Reference


Detailed Description

Subsystem: Miscellaneous/Utility (PKIFUTILS)

Module: Miscellaneous

Id
ToolkitUtils_logging.cpp 10621 2009-09-30 19:03:21Z cwallace

Definition in file ToolkitUtils_logging.cpp.

#include "PKIFdll.h"
#include "components.h"
#include "PKIFErrors.h"
#include "ToolkitUtils.h"
#include "PKIFLog.h"
#include "PKIFCertificatePath.h"
#include "EventLog.h"
#include "OID.h"
#include "AlgorithmIdentifier.h"
#include "PolicyInformation.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <bitset>
#include <iomanip>
#include <cstring>

Include dependency graph for ToolkitUtils_logging.cpp:

Go to the source code of this file.

Functions

void configureLogging ()
 defined _DISABLE_ALL_LOGGING
void InitGlobalOIDs ()
void GetObjectDesc (DWORD subcomponentID, char *numbuf)
bool InitPKIF (void)
long filesize (FILE *stream)
void GetLoggingIndicator (DWORD *value)
bool GetLogFile (char *ppszFilename, unsigned long *pnLen)
bool GetPathLogFile (char *ppszFilename, unsigned long *pnLen)
bool InitLogging ()
void CAC_API LogString (const char *errorMessage, DWORD subcomponentID, DWORD errorCode, const void *objectPointer, nsCLog::eSeverity threshold, const char *fileName, int lineNumber)
bool TerminateLogging ()
bool InitAudit ()
void AuditString (int eventType, int eventCat, int eventID, const char *str, DWORD subcomponentID, DWORD errorCode, void *objectPointer)
bool TerminateAudit ()
 _NO_AUDITFACILITY
void CAC_API AuditPathEvent (PathOp op, bool succeeded, CPKIFCertificatePath &path)

Variables

CAC_API CPKIFOIDPtr g_md2WithRSAEncryption
CAC_API CPKIFOIDPtr g_md5WithRSAEncryption
CAC_API CPKIFOIDPtr g_sha1WithRSAEncryption
CAC_API CPKIFOIDPtr g_sha224WithRSAEncryption
CAC_API CPKIFOIDPtr g_sha256WithRSAEncryption
CAC_API CPKIFOIDPtr g_sha384WithRSAEncryption
CAC_API CPKIFOIDPtr g_sha512WithRSAEncryption
CAC_API CPKIFOIDPtr g_dsaWithSHA1
CAC_API CPKIFOIDPtr g_dsaWithSHA1Alternative
CAC_API CPKIFOIDPtr g_dsa
CAC_API CPKIFOIDPtr g_rsa
CAC_API CPKIFOIDPtr g_ecc
CAC_API CPKIFOIDPtr g_ecdsa_sha1
CAC_API CPKIFOIDPtr g_ecdsa_rec
CAC_API CPKIFOIDPtr g_ecdsa_params
CAC_API CPKIFOIDPtr g_ecdsa_sha224
CAC_API CPKIFOIDPtr g_ecdsa_sha256
CAC_API CPKIFOIDPtr g_ecdsa_sha384
CAC_API CPKIFOIDPtr g_ecdsa_sha512
CAC_API CPKIFOIDPtr g_ecdh_std_sha1kdf
CAC_API CPKIFOIDPtr g_ecdh_cofactor_sha1kdf
CAC_API CPKIFOIDPtr g_ecmqv_sha1kdf
CAC_API CPKIFOIDPtr g_ecdh_std_sha256kdf
CAC_API CPKIFOIDPtr g_ecdh_std_sha384kdf
CAC_API CPKIFOIDPtr g_sha1
CAC_API CPKIFOIDPtr g_sha224
CAC_API CPKIFOIDPtr g_sha256
CAC_API CPKIFOIDPtr g_sha384
CAC_API CPKIFOIDPtr g_sha512
CAC_API CPKIFOIDPtr g_md5
CAC_API CPKIFOIDPtr g_desCBC
CAC_API CPKIFOIDPtr g_tdesCBC
CAC_API CPKIFOIDPtr g_tdesECB
CAC_API CPKIFOIDPtr g_desECB
CAC_API CPKIFOIDPtr g_aes128ECB
CAC_API CPKIFOIDPtr g_aes128CBC
CAC_API CPKIFOIDPtr g_aes192ECB
CAC_API CPKIFOIDPtr g_aes192CBC
CAC_API CPKIFOIDPtr g_aes256ECB
CAC_API CPKIFOIDPtr g_aes256CBC
CAC_API CPKIFOIDPtr g_aes128Wrap
CAC_API CPKIFOIDPtr g_aes192Wrap
CAC_API CPKIFOIDPtr g_aes256Wrap
CAC_API CPKIFOIDPtr g_contentInfo
CAC_API CPKIFOIDPtr g_data
CAC_API CPKIFOIDPtr g_signedData
CAC_API CPKIFOIDPtr g_envelopedData
CAC_API CPKIFOIDPtr g_encryptedData
CAC_API CPKIFOIDPtr g_contentCollection
CAC_API CPKIFOIDPtr g_contentWithAttributes
CAC_API CPKIFOIDPtr g_compressedData
CAC_API CPKIFOIDPtr g_authenticatedData
CAC_API CPKIFOIDPtr g_digestedData
CAC_API CPKIFOIDPtr g_authEnvelopedData
CAC_API CPKIFOIDPtr g_contentTypeAttribute
CAC_API CPKIFOIDPtr g_messageDigestAttribute
CAC_API CPKIFOIDPtr g_signingTimeAttribute
CAC_API CPKIFOIDPtr g_countersignatureAttribute
CAC_API CPKIFOIDPtr g_timestampAttribute
CAC_API CPKIFOIDPtr g_archiveTokenAttribute
CAC_API CPKIFOIDPtr g_binarySigningTimeAttribute
CAC_API CPKIFOIDPtr g_signingCertificateAttribute
CAC_API CPKIFOIDPtr g_timestampingEKU
CAC_API CPKIFOIDPtr g_ocspSigningEKU
CAC_API CPKIFOIDPtr g_anyEKU
CAC_API CPKIFOIDPtr g_anyPolicyOID
CAC_API CPKIFOIDPtr g_aiaCAIssuer
CAC_API CPKIFOIDPtr g_aiaCARepository
CAC_API CPKIFOIDPtr g_secp224r1
CAC_API CPKIFOIDPtr g_secp256r1
CAC_API CPKIFOIDPtr g_secp384r1
CAC_API CPKIFOIDPtr g_secp521r1
CAC_API CPKIFAlgorithmIdentifierPtr g_md5AI
CAC_API CPKIFAlgorithmIdentifierPtr g_sha1AI
CAC_API CPKIFAlgorithmIdentifierPtr g_sha256AI
CAC_API CPKIFAlgorithmIdentifierPtr g_sha384AI
CAC_API CPKIFAlgorithmIdentifierPtr g_sha512AI
CAC_API CPKIFPolicyInformationPtr g_anyPolicy
CAC_API unsigned char g_nullParams [] = {0x05,0x00}


Function Documentation

void CAC_API AuditPathEvent ( PathOp  op,
bool  succeeded,
CPKIFCertificatePath path 
)

Interface: External

This function is not used by applications. It is invoked by the CPKIFPathProcessingMediator2 class to audit path processing-related events.

Returns:
None
Parameters:
op  [in] PathOp object.
succeeded  [in] Boolean value.
path  [in] CPKIFCertificatePath object

Definition at line 722 of file ToolkitUtils_logging.cpp.

References AuditString, CAT_PKIF_PATH, GetCertInfo(), CPKIFCertificatePath::GetTarget(), PKIF_PATH_OPERATION_FAILED, PKIF_PATH_OPERATION_SUCCEEDED, PO_VALIDATE, and TOOLKIT_PATH_MEDIATOR.

Referenced by CPKIFPathProcessingMediator2::BuildPath(), and CPKIFPathProcessingMediator2::ValidatePath().

void AuditString ( int  eventType,
int  eventCat,
int  eventID,
const char *  str,
DWORD  subcomponentID,
DWORD  errorCode,
void *  objectPointer 
)

Interface: External

This function is not used by applications. It is invoked internally to generate event log records for notable events.

Returns:
None
Parameters:
eventType  [in] Integer value which contains the even type ID.
eventCat  [in] Integer value which contains the even category ID.
eventID  [in] Integer value which contains the even ID.
str  [in] A pointer to a NULL terminated string.
subcomponentID  [in] DWORD
errorCode  [in] DWORD
objectPointer  [in] Pointer to the object that generated the audit event

Definition at line 658 of file ToolkitUtils_logging.cpp.

References CEventLog::Write().

void configureLogging (  ) 

defined _DISABLE_ALL_LOGGING

long filesize ( FILE *  stream  ) 

Interface: Subsystem

Helper function that returs the size of a given file

Returns:
File size
Parameters:
stream  [in] Pointer to a file which size which size will be determined.

Definition at line 285 of file ToolkitUtils_logging.cpp.

Referenced by InitLogging().

bool GetLogFile ( char *  ppszFilename,
unsigned long *  pnLen 
)

Interface: Subsystem

Helper function retrives log file location from the registry.

Returns:
File size
Parameters:
ppszFilename  [out] string indicating the location of the log file

Definition at line 343 of file ToolkitUtils_logging.cpp.

Referenced by InitLogging().

void GetLoggingIndicator ( DWORD value  ) 

Interface: Subsystem

Helper function retrives logging indicator from the registry.

Returns:
File size

Definition at line 304 of file ToolkitUtils_logging.cpp.

Referenced by InitLogging().

void GetObjectDesc ( DWORD  subcomponentID,
char *  numbuf 
)

bool GetPathLogFile ( char *  ppszFilename,
unsigned long *  pnLen 
)

Interface: Subsystem

Helper function retrives path log file location from the registry.

Returns:
File size
Parameters:
ppszFilename  [out] string indicating the location of the log file

Definition at line 381 of file ToolkitUtils_logging.cpp.

Referenced by InitLogging().

bool InitAudit (  ) 

Interface: Subsystem

This function initializes logging

Returns:
True if logging was initialization was successful, false otherwise

Definition at line 627 of file ToolkitUtils_logging.cpp.

References CEventLog::AddEventSource().

void InitGlobalOIDs (  ) 

Interface: Subsystem

This is a helper function that initializes the global OIDs

Returns:
None

Definition at line 888 of file ToolkitUtils_logging.cpp.

References data.

Referenced by InitPKIF().

bool InitLogging (  ) 

Interface: Subsystem

This is a helper function that initializes loggin.

The logging functions work as follows. InitLogging is called from DLLMain upon DLL_PROCESS_ATTACH. It retrieves the log file name and logging indicator from the registry. THIS IS THE ONLY TIME THE REGISTRY IS CONSULTED DURING THE LIFE OF PKIF.DLL. LogString is called periodically by the various mediators and other components that perform logging. The components pass one of the LOGGING_xxx macros which is checked by LogString and compared to g_loggingIndicator. TerminateLogging is called from DLLMain upon DLL_PROCESS_DETACH. FILE* g_logFile = NULL;

Returns:
True if logging was sucessfully initialized

Definition at line 434 of file ToolkitUtils_logging.cpp.

References AuditString, nsCLog::debug, nsCLog::error, filesize(), GetLogFile(), GetLoggingIndicator(), GetPathLogFile(), nsCLog::info, PKIF_UNEXPECTED_EXCEPTION, PKIF_UTILS, TerminateLogging(), TOOLKIT_PKIF_DLL, and nsCLog::warning.

Referenced by InitPKIF().

bool InitPKIF ( void   ) 

Interface: Subsystem

This function initializes global OIDs and PKIF logging

Returns:
True if initializes was successful, false otherwise

Definition at line 264 of file ToolkitUtils_logging.cpp.

References InitGlobalOIDs(), and InitLogging().

void CAC_API LogString ( const char *  errorMessage,
DWORD  subcomponentID,
DWORD  errorCode,
const void *  objectPointer,
nsCLog::eSeverity  threshold,
const char *  fileName,
int  lineNumber 
)

Interface: External

This function is not used by applications. It is only used in debug builds of PKIF for internal test purposes.

Returns:
None
Parameters:
errorMessage  [in] A NULL terminated string.
subcomponentID  DWORD
errorCode  DWORD
objectPointer  [in] Pointer to the object generating the log record
threshold  [in] Type of log event
fileName  [in] A NULL terminated string.
lineNumber  [in] Integer value indicating the line number where the error occurred.

Definition at line 536 of file ToolkitUtils_logging.cpp.

References GetErrorCodeString(), GetObjectDesc(), MAX_ERROR_CODE_STRING_SIZE, and TOOLKIT_SUBCOMPONENT_MULTIPLIER.

bool TerminateAudit (  ) 

_NO_AUDITFACILITY

Interface: Subsystem

This is a helper function that terminates auditing

Returns:
None

Definition at line 711 of file ToolkitUtils_logging.cpp.

bool TerminateLogging (  ) 

Interface: Subsystem

This is a helper function that terminates loggin

Returns:
None

Definition at line 615 of file ToolkitUtils_logging.cpp.

Referenced by InitLogging().


Variable Documentation

CAC_API CPKIFOIDPtr g_aes128CBC

Definition at line 819 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes128ECB

Definition at line 818 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes128Wrap

CAC_API CPKIFOIDPtr g_aes192CBC

Definition at line 821 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes192ECB

Definition at line 820 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes192Wrap

CAC_API CPKIFOIDPtr g_aes256CBC

Definition at line 823 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes256ECB

Definition at line 822 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_aes256Wrap

CAC_API CPKIFOIDPtr g_aiaCAIssuer

CAC_API CPKIFOIDPtr g_aiaCARepository

CAC_API CPKIFOIDPtr g_anyEKU

CAC_API CPKIFPolicyInformationPtr g_anyPolicy

CAC_API CPKIFOIDPtr g_anyPolicyOID

Definition at line 858 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_archiveTokenAttribute

Definition at line 849 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_authenticatedData

Definition at line 839 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_authEnvelopedData

Definition at line 841 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_binarySigningTimeAttribute

Definition at line 850 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFBinarySigningTimeAttribute::GetOID().

CAC_API CPKIFOIDPtr g_compressedData

Definition at line 838 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_contentCollection

CAC_API CPKIFOIDPtr g_contentInfo

Definition at line 830 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFContentInfo::CPKIFContentInfo().

CAC_API CPKIFOIDPtr g_contentTypeAttribute

CAC_API CPKIFOIDPtr g_contentWithAttributes

CAC_API CPKIFOIDPtr g_countersignatureAttribute

Definition at line 847 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFCountersignatureAttribute::GetOID().

CAC_API CPKIFOIDPtr g_data

CAC_API CPKIFOIDPtr g_desCBC

Definition at line 813 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_desECB

Definition at line 816 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_digestedData

Definition at line 840 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_dsa

CAC_API CPKIFOIDPtr g_dsaWithSHA1

CAC_API CPKIFOIDPtr g_dsaWithSHA1Alternative

Definition at line 787 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and GetOIDString().

CAC_API CPKIFOIDPtr g_ecc

CAC_API CPKIFOIDPtr g_ecdh_cofactor_sha1kdf

Definition at line 801 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_ecdh_std_sha1kdf

Definition at line 800 of file ToolkitUtils_logging.cpp.

Referenced by GetSymmetricKey().

CAC_API CPKIFOIDPtr g_ecdh_std_sha256kdf

CAC_API CPKIFOIDPtr g_ecdh_std_sha384kdf

CAC_API CPKIFOIDPtr g_ecdsa_params

Definition at line 793 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_ecdsa_rec

Definition at line 792 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_ecdsa_sha1

CAC_API CPKIFOIDPtr g_ecdsa_sha224

CAC_API CPKIFOIDPtr g_ecdsa_sha256

CAC_API CPKIFOIDPtr g_ecdsa_sha384

CAC_API CPKIFOIDPtr g_ecdsa_sha512

CAC_API CPKIFOIDPtr g_ecmqv_sha1kdf

Definition at line 802 of file ToolkitUtils_logging.cpp.

Referenced by GetSymmetricKey(), and CPKIFCryptoPP::SecretAgree().

CAC_API CPKIFOIDPtr g_encryptedData

Definition at line 834 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFEncryptedData::CPKIFEncryptedData().

CAC_API CPKIFOIDPtr g_envelopedData

Definition at line 833 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFEnvelopedData::CPKIFEnvelopedData().

CAC_API CPKIFOIDPtr g_md2WithRSAEncryption

Definition at line 779 of file ToolkitUtils_logging.cpp.

Referenced by GetAlgClass(), and GetOIDString().

CAC_API CPKIFOIDPtr g_md5

CAC_API CPKIFAlgorithmIdentifierPtr g_md5AI

Definition at line 871 of file ToolkitUtils_logging.cpp.

Referenced by GetHashAlgAI().

CAC_API CPKIFOIDPtr g_md5WithRSAEncryption

CAC_API CPKIFOIDPtr g_messageDigestAttribute

CAC_API unsigned char g_nullParams[] = {0x05,0x00}

CAC_API CPKIFOIDPtr g_ocspSigningEKU

Definition at line 855 of file ToolkitUtils_logging.cpp.

Referenced by EKUChecker_OcspSigning().

CAC_API CPKIFOIDPtr g_rsa

CAC_API CPKIFOIDPtr g_secp224r1

Definition at line 863 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_secp256r1

Definition at line 864 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_secp384r1

Definition at line 865 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_secp521r1

Definition at line 866 of file ToolkitUtils_logging.cpp.

CAC_API CPKIFOIDPtr g_sha1

CAC_API CPKIFAlgorithmIdentifierPtr g_sha1AI

CAC_API CPKIFOIDPtr g_sha1WithRSAEncryption

CAC_API CPKIFOIDPtr g_sha224

CAC_API CPKIFOIDPtr g_sha224WithRSAEncryption

CAC_API CPKIFOIDPtr g_sha256

CAC_API CPKIFAlgorithmIdentifierPtr g_sha256AI

Definition at line 873 of file ToolkitUtils_logging.cpp.

Referenced by GetHashAlgAI().

CAC_API CPKIFOIDPtr g_sha256WithRSAEncryption

CAC_API CPKIFOIDPtr g_sha384

CAC_API CPKIFAlgorithmIdentifierPtr g_sha384AI

Definition at line 874 of file ToolkitUtils_logging.cpp.

Referenced by GetHashAlgAI().

CAC_API CPKIFOIDPtr g_sha384WithRSAEncryption

CAC_API CPKIFOIDPtr g_sha512

CAC_API CPKIFAlgorithmIdentifierPtr g_sha512AI

Definition at line 875 of file ToolkitUtils_logging.cpp.

Referenced by GetHashAlgAI().

CAC_API CPKIFOIDPtr g_sha512WithRSAEncryption

CAC_API CPKIFOIDPtr g_signedData

CAC_API CPKIFOIDPtr g_signingCertificateAttribute

Definition at line 851 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFSigningCertificateAttribute::GetOID().

CAC_API CPKIFOIDPtr g_signingTimeAttribute

Definition at line 846 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFSigningTimeAttribute::GetOID().

CAC_API CPKIFOIDPtr g_tdesCBC

Definition at line 814 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_tdesECB

Definition at line 815 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFAlgorithm::GetAlg(), and CPKIFAlgorithm::init().

CAC_API CPKIFOIDPtr g_timestampAttribute

Definition at line 848 of file ToolkitUtils_logging.cpp.

Referenced by CPKIFTimestampAttribute::GetOID().

CAC_API CPKIFOIDPtr g_timestampingEKU


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