Safeheron-SGX-Native-Development-Framework v1.2.0
Loading...
Searching...
No Matches
ssgx::filesystem_t::ProtectedFileWriter Class Reference

A ProtectedFileWriter for writing to the Intel SGX Protected File System. More...

#include <ssgx_filesystem_t.h>

Public Member Functions

 ProtectedFileWriter (const ProtectedFileWriter &)=delete
 
ProtectedFileWriteroperator= (const ProtectedFileWriter &)=delete
 
 ProtectedFileWriter (const char *file_name, FileMode file_mode=FileMode::CreateNew, uint16_t key_policy=SGX_KEYPOLICY_MRENCLAVE)
 Opens a file for writing.
 
 ~ProtectedFileWriter ()
 
void Write (const void *data, size_t size) const
 Writes data to the file.
 
void Flush () const
 Flushes any buffered data to disk.
 
void Close ()
 Closes the file.
 

Detailed Description

A ProtectedFileWriter for writing to the Intel SGX Protected File System.

Constructor & Destructor Documentation

◆ ProtectedFileWriter() [1/2]

ssgx::filesystem_t::ProtectedFileWriter::ProtectedFileWriter ( const ProtectedFileWriter & )
delete

◆ ProtectedFileWriter() [2/2]

ssgx::filesystem_t::ProtectedFileWriter::ProtectedFileWriter ( const char * file_name,
FileMode file_mode = FileMode::CreateNew,
uint16_t key_policy = SGX_KEYPOLICY_MRENCLAVE )
explicit

Opens a file for writing.

Parameters
file_nameThe name of the file to create or overwrite (must be a valid, non-null C-string).
file_modeOne of FileMode to identify the writing operation mode.
key_policyThe key policy for sealing operations (default: SGX_KEYPOLICY_MRENCLAVE).
Exceptions
FileSystemExceptionIf the file cannot be opened.

◆ ~ProtectedFileWriter()

ssgx::filesystem_t::ProtectedFileWriter::~ProtectedFileWriter ( )

Member Function Documentation

◆ Close()

void ssgx::filesystem_t::ProtectedFileWriter::Close ( )

Closes the file.

Exceptions
FileSystemExceptionIf closing fails.

◆ Flush()

void ssgx::filesystem_t::ProtectedFileWriter::Flush ( ) const

Flushes any buffered data to disk.

Exceptions
FileSystemExceptionIf flushing fails.

◆ operator=()

ProtectedFileWriter & ssgx::filesystem_t::ProtectedFileWriter::operator= ( const ProtectedFileWriter & )
delete

◆ Write()

void ssgx::filesystem_t::ProtectedFileWriter::Write ( const void * data,
size_t size ) const

Writes data to the file.

Parameters
dataPointer to the data to be written (must not be null).
sizeSize of the data in bytes (must be > 0). For small files, the recommended size is 4KB; For big files, the recommended size is 64KB; Don't set size >= 256KB.
Exceptions
FileSystemExceptionIf writing fails.

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