FileUtils.cpp File Reference


Detailed Description

Subsystem: Miscellaneous/Utility (PKIFUTILS)

Module: Miscellaneous

Id
FileUtils.cpp 12017 2010-11-08 19:49:11Z agalustyan

Definition in file FileUtils.cpp.

#include "FileUtils.h"
#include "Certificate.h"
#include "ToolkitUtils.h"
#include "components.h"
#include "PKIFException.h"
#include "PKIFErrors.h"
#include "Buffer.h"
#include "boost/filesystem/path.hpp"
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/fstream.hpp"
#include <iostream>
#include <sstream>
#include "boost/numeric/conversion/cast.hpp"
#include "boost/numeric/conversion/bounds.hpp"
#include "boost/limits.hpp"

Include dependency graph for FileUtils.cpp:

Go to the source code of this file.

Functions

CPKIFBufferPtr CAC_API ReadFileIntoBuffer (const std::string &filename) throw (CPKIFException)
CPKIFCertificatePtr DecodeCertFromFile (const std::string &filename) throw (CPKIFException)
void WriteBufferToFile (const std::string &filename, CPKIFBufferPtr &buf)


Function Documentation

CPKIFCertificatePtr DecodeCertFromFile ( const std::string &  filename  )  throw (CPKIFException)

Interface: Subsystem

This is a helper function that decodes a DER encoded certificate and returns a smart pointer to a CPKIFCertificate object containing that certificate.

NOTE: This function is intended for certificate files only. A possible buffer overflow might occur if the function is called on a very large file.

Returns:
A smart pointer toCPKIFCertificate object containing the decoded certificate
Exceptions:
CPKIFPathException(COMMON_INVALID_INPUT) 
Parameters:
filename  [in] std:: string containing the file location of the der encoded certificate

Definition at line 101 of file FileUtils.cpp.

References ReadFileIntoBuffer().

Referenced by CExtractInfoFromCertDialog::CExtractInfoFromCertDialog().

CPKIFBufferPtr CAC_API ReadFileIntoBuffer ( const std::string &  filename  )  throw (CPKIFException)

Interface: Subsystem

This is a helper function that reads a file into a buffer

NOTE: This function is intended for small files only, i.e. certificates

Returns:
A smart pointer to a CPKIFBuffer object with the contents of the file
Exceptions:
CPKIFException(COMMON_INVALID_INPUT) 
Parameters:
filename  [in] std:: string containing the file location

Definition at line 44 of file FileUtils.cpp.

References COMMON_INVALID_INPUT, TOOLKIT_UTILS, and TOOLKIT_UTILS_SUBCOMPONENT.

Referenced by _MakeCredentialFromP8File(), DecodeCertFromFile(), and MakeCredentialFromP8File().

void WriteBufferToFile ( const std::string &  filename,
CPKIFBufferPtr &  buf 
)

Interface: Subsystem

This is a helper function that writes a buffer into a file

Returns:
None
Exceptions:
CPKIFPathException(COMMON_INVALID_INPUT) 
CPKIFPathException(COMMON_OPERATION_NOT_SUCCESSFUL) 
Parameters:
filename  [in] std::string containing the filename into which the buffer will be written
buf  [in] A smart pointer to CPKIFBuffer object containing the data that will be written into a file

Definition at line 120 of file FileUtils.cpp.

References COMMON_INVALID_INPUT, COMMON_OPERATION_NOT_SUCCESSFUL, and TOOLKIT_UTILS_SUBCOMPONENT.

Referenced by PathDumpDialog::SaveLogToDisk(), PathDumpDialog::SavePathToDisk(), PathDumpDialog::SaveRIToDisk(), and WriteCertsFromOcspResponseToFile().


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