Module: Miscellaneous
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"
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) |
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.
CPKIFPathException(COMMON_INVALID_INPUT) |
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
CPKIFException(COMMON_INVALID_INPUT) |
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
CPKIFPathException(COMMON_INVALID_INPUT) | ||
CPKIFPathException(COMMON_OPERATION_NOT_SUCCESSFUL) |
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().