In file /home/eternity/Source/Eso/TCBWrapper/H/tcbWrapper.h:

class SWTCBWrapper : public TCBWrapper

Software Trusted Computing Base wrapper

Inheritance:

SWTCBWrapper < TCBWrapper < Rollbackable


Public Methods

Err SWTCBWrapper::CertTableFindByACID ( const ACID acid, const shouldClose, GMessage **acPubKey, GMessage **acPrivKey, GMessage **tcbPubKey, GMessage **tcbPrivKey)
Finds record in certifTable
Err SWTCBWrapper::CertTableInsert ( const ACID acid, const GMessage *acPubKey, const GMessage *acPrivKey, const GMessage *tcbPubKey, const GMessage *tcbPrivKey)
Inserts record to certifTabel
Err SWTCBWrapper::ComputeMAC (const ID fid, const MsgField *oAuth, MsgField **mac)
Computes MAC
GMessage* SWTCBWrapper::CreateReplyFileHeader (const GMessage *clientPubKey, const MsgField *ffid, const Size size)
Creates a header to reply
MsgField* SWTCBWrapper::DecryptByACPriv (const ACID acid, const MsgField *data)
Decrypts by private key
MsgField* SWTCBWrapper::DecryptByTCBPriv (const ACID acid, const MsgField *data)
Decrypts data with private key
Err SWTCBWrapper::DeleteFileByFileID (const ID fid)
Deletes file by file ID
Err SWTCBWrapper::GenerateACKeys (ACID *acid, GMessage **acPubKey, GMessage **tcbPubKey)
Generates keys for access certificate
Err SWTCBWrapper::GetACPubKeys (const ACID acid, GMessage **acPubKey, GMessage **tcbPubKey)
Returns public keys
MsgField* SWTCBWrapper::GetFileByFinderFID (const ACID acid, const MsgField *ffid, const GMessage *clientPubKey)
Pops file with ffid
Queue* SWTCBWrapper::GetFileHeadersByFAM (const ACID acid, const MsgField *fam, const GMessage *clientPubKey)
Searches for file by file attribute mask
Err SWTCBWrapper::GetRingKeys (GMessage ** ringKeys)
Loads ring keys
Err SWTCBWrapper::InstantiateTCBTables (const GMessage *ringKeys)
Initializes all TCBTables
Err SWTCBWrapper::LoadMasterKey ()
Loads master key
Err SWTCBWrapper::RefreshMasterKey ()
Create new master key and reencrypt the file that stores ring keys
Err SWTCBWrapper::RefreshRingKeys ()
Create new ring keys and reencrypt certifTable and certifTable
Err SWTCBWrapper::RemoveACKeys (const ACID acid)
Removes access certificate keys
Err SWTCBWrapper::Rollback (const TID tid)
Rolls back a transaction
SWTCBWrapper::SWTCBWrapper (Eso *anEso, LogFile *aLogFile)
SWTCBWrapper constructor
Err SWTCBWrapper::SaveFile (const ACID acid, const ID fid, const MsgField *ffid, const MsgField *keywords, const MsgField *data)
Saves file
Err SWTCBWrapper::StorTableFindByFFID ( const MsgField *ffid, Char **fileName, GMessage **storageKey, Keywords **keywords, Size *size)
Finds record in storageTable
Err SWTCBWrapper::StorTableFindByFID ( const ID fid, const Int shouldClose, Char **fileName, GMessage **storageKey)
Finds record in storageTable
Err SWTCBWrapper::StorTableInsert ( const ID fid, const MsgField *ffid, const Char *fileName, const GMessage *storageKey, const MsgField *keywords, const Size fileSize)
Inserts record to storageTable
Err SWTCBWrapper::StorTableParseRecord (const Record *storRec, ID *fid, MsgField **ffid, Char **fileName, GMessage **storageKey, Keywords **keywords, Size *fileSize)
Parses record got from storageTable
SWTCBWrapper::~SWTCBWrapper ()
SWTCBWrapper destructor

Public

methods
SWTCBWrapper (Eso *anEso, LogFile *aLogFile = NULL)
Software TCBWrapper constructor.
virtual ~SWTCBWrapper ()
Hardware TCBWrapper constructor.
virtual Err Rollback (const TID tid)
Ability to be rollbacked.
virtual Err SaveFile ( const ACID acid, const ID fid, const MsgField *ffid, const MsgField *keywords, const MsgField *data)
Stores file kept in "data" with ID "fid"
virtual Err DeleteFileByFileID (const ID fid)
Deletes a file.
virtual Err ComputeMAC (const ID fid, const MsgField *oAuth, MsgField **mac)
Computes MAC by finding a file and concatenating it with OAuth.
virtual Queue* GetFileHeadersByFAM ( const ACID acid, const MsgField *fam, const GMessage *clientPubKey)
Finds all files matching the File Atribute Mask, and returns their headers that include FinderFileID, FileSize
virtual MsgField* GetFileByFinderFID ( const ACID acid, const MsgField *ffid, const GMessage *clientPubKey)
Finds the file with "ffid", decrypts it, reencrypts it with "clientPubKey" and returns it as a MsgField
virtual MsgField* DecryptByACPriv (const ACID acid, const MsgField *data)
Finds aproprite private key and returns decrypted "data".
virtual Err GenerateACKeys ( ACID *acid, GMessage **acPubKey, GMessage **tcbPubKey)
Generates and stores AC keys (both AC and TCB).
virtual Err GetACPubKeys ( const ACID, GMessage **acPubKey = NULL, GMessage **tcbPubKey = NULL)
Returns pub keys to ACID.
virtual Err RemoveACKeys (const ACID acid)
Removes AC keys (both AC and TCB).
virtual Err RefreshMasterKey ()
Generates new Master Key and does all reencryption needed (table of ring keys)
virtual Err RefreshRingKeys ()
Generates new Ring Keys and does all reencryption needed (table of files and storage keys, table of certificates, table of transport keys)
Void Test ()
Test method for debugging purposes only.

Protected

attributes
GMessage* masterKey
Symmetric key used as a master key for hierarchical key management.

Table with information about stored files, encrypted with a ring
TCBTable* storageTable
key from a level below master key in key hierarchy.

Table with Access Certificates keys, encrypted with its ring key
TCBTable* certifTable
from a level below master key in key hierarchy.
methods

Methods used only by constructor

TCBTables management methods
MsgField* DecryptByTCBPriv (const ACID acid, const MsgField *data)
Finds aproprite TCB private key and returns decrypted "data".
GMessage* CreateReplyFileHeader (const GMessage *clientPubKey, const MsgField *ffid, const Size size)
Creates encrypted header. Used when searching by keywords.

Inherited from TCBWrapper:

Public Methods

TCBWrapper::TCBWrapper(Eso *anEso, LogFile *aLogFile)
TCBWrapper::~TCBWrapper()

Inherited from Rollbackable:

Public

methods

virtual Err Rollback(TID)
Raoll back and return to a consistent state

Inherited from Debugable:

Public Methods

string* Debugable::CreateString(char *firstStr, int firstInt, int secondInt)
Debugable::Debugable(LogFile * debugLogFile)
int Debugable::SetDebugOptions(int newLogOptions)
void Debugable::SetLogFile(LogFile *aLogFile)
void Debugable::WriteString(LogLevel debugLevel, char * format, ...)
Debugable::~Debugable()

Public

attributes

int debugOptions
What messages should be logged
LogFile* logFile
Log file for debug messages

Inherited from SixOffspring:

Public Methods

SixOffspring::SixOffspring(Six * aSix)

Documentation

Software Trusted Computing Base wrapper. This class realizes all TCB tasks purely programmaticaly without need of any hardware.
attributes

GMessage* masterKey
Symmetric key used as a master key for hierarchical key management.

Table with information about stored files, encrypted with a ring

TCBTable* storageTable
key from a level below master key in key hierarchy.

Table with Access Certificates keys, encrypted with its ring key

TCBTable* certifTable
from a level below master key in key hierarchy.

methods

Methods used only by constructor

TCBTables management methods

MsgField* DecryptByTCBPriv(const ACID acid, const MsgField *data)
Finds aproprite TCB private key and returns decrypted "data".

GMessage* CreateReplyFileHeader(const GMessage *clientPubKey, const MsgField *ffid, const Size size)
Creates encrypted header. Used when searching by keywords.

methods

SWTCBWrapper(Eso *anEso, LogFile *aLogFile = NULL)
Software TCBWrapper constructor.

virtual ~SWTCBWrapper()
Hardware TCBWrapper constructor.

virtual Err Rollback(const TID tid)
Ability to be rollbacked.

virtual Err SaveFile( const ACID acid, const ID fid, const MsgField *ffid, const MsgField *keywords, const MsgField *data)
Stores file kept in "data" with ID "fid". "ffid", "keywords", "data" encrypted with TCBPubKey.

virtual Err DeleteFileByFileID(const ID fid)
Deletes a file.

virtual Err ComputeMAC(const ID fid, const MsgField *oAuth, MsgField **mac)
Computes MAC by finding a file and concatenating it with OAuth.

virtual Queue* GetFileHeadersByFAM( const ACID acid, const MsgField *fam, const GMessage *clientPubKey)
Finds all files matching the File Atribute Mask, and returns their headers that include FinderFileID, FileSize. FAM encrypted by TCB Public Key.

virtual MsgField* GetFileByFinderFID( const ACID acid, const MsgField *ffid, const GMessage *clientPubKey)
Finds the file with "ffid", decrypts it, reencrypts it with "clientPubKey" and returns it as a MsgField

virtual MsgField* DecryptByACPriv(const ACID acid, const MsgField *data)
Finds aproprite private key and returns decrypted "data".

virtual Err GenerateACKeys( ACID *acid, GMessage **acPubKey, GMessage **tcbPubKey)
Generates and stores AC keys (both AC and TCB).

virtual Err GetACPubKeys( const ACID, GMessage **acPubKey = NULL, GMessage **tcbPubKey = NULL)
Returns pub keys to ACID.

virtual Err RemoveACKeys(const ACID acid)
Removes AC keys (both AC and TCB).

virtual Err RefreshMasterKey()
Generates new Master Key and does all reencryption needed (table of ring keys)

virtual Err RefreshRingKeys()
Generates new Ring Keys and does all reencryption needed (table of files and storage keys, table of certificates, table of transport keys)

Void Test()
Test method for debugging purposes only.

Err SWTCBWrapper::CertTableFindByACID( const ACID acid, const shouldClose, GMessage **acPubKey, GMessage **acPrivKey, GMessage **tcbPubKey, GMessage **tcbPrivKey)
Finds record in certifTable. Searches open table for appearance of record with appropriate search file ID. Enables to close certifTable after successfull search.
Returns:
error code
Parameters:
acid - Access certificate ID
shouldClose - Should I close the certifTable, after I'm finished?
acPubKey - Access certificate public key (out parameter)
acPrivKey - Access certificate private key (out parameter)
tcbPubKey - TCB public key (out parameter)
tcbPrivKey - TCB private key (out parameter)
Author:
Pavel
See Also:

Err SWTCBWrapper::CertTableInsert( const ACID acid, const GMessage *acPubKey, const GMessage *acPrivKey, const GMessage *tcbPubKey, const GMessage *tcbPrivKey)
Inserts record to certifTabel. Creates new Record for certifTable, fills it with given arguments and inserts it to certifTable.
Returns:
error code
Parameters:
acid - Access certificate ID
acPubKey - Access certificate public key
acPrivKey - Access certificate private key
tcbPubKey - TCB public key
tcbPrivKey - TCB private key
Author:
Pavel
See Also:

Err SWTCBWrapper::ComputeMAC(const ID fid, const MsgField *oAuth, MsgField **mac)
Computes MAC. Computes hash from stored file and given oAuth.
Returns:
error code
Parameters:
fid - ID of a file MAC should be counted from
oAuth - String sent by bank to verify file owner
mac - Counted hash (out parameter)
Author:
Pavel
See Also:
Cipherer, CreateTempFileName()

GMessage* SWTCBWrapper::CreateReplyFileHeader(const GMessage *clientPubKey, const MsgField *ffid, const Size size)
Creates a header to reply. This method creates header by encrypting given file size and search file ID with client's public key and giving them into GMessage.
Returns:
Header encrypted by clientPubKey
Parameters:
clientPubKey - Public key to encrypt header with
ffid - Search file ID to include in header
size - File size to include in header
Author:
Pavel
See Also:

MsgField* SWTCBWrapper::DecryptByACPriv(const ACID acid, const MsgField *data)
Decrypts by private key. Decrypts data with private key identified by access certificate ID. Private key is found in certifTable.
Returns:
Decrypted data if successfull, NULL otherwise
Parameters:
acid - Access certificate ID identifying access public key that was used to encrypt data
data - Data whished to decrypt
Author:
Pavel
See Also:
Cipherer, CertTableFindByACID()

MsgField* SWTCBWrapper::DecryptByTCBPriv(const ACID acid, const MsgField *data)
Decrypts data with private key. Decrypts data with TCB private key identified by access certificate ID. Proper key is found in certifTable by acid.
Returns:
Decrypted data
Parameters:
acid - Access certificate ID
data - Data to be encrypted by TCB private key
Author:
Pavel
See Also:

Err SWTCBWrapper::DeleteFileByFileID(const ID fid)
Deletes file by file ID. What more should be said?
Returns:
error code
Parameters:
fid - ID of a file to be deleted
Author:
Pavel
See Also:

Err SWTCBWrapper::GenerateACKeys(ACID *acid, GMessage **acPubKey, GMessage **tcbPubKey)
Generates keys for access certificate. Generates asymetric key pairs for access certificate and stores them in certifTable to be able to use them automatically later given only access certificate ID, that is generated as well.
Returns:
error code
Parameters:
acid - Generated access certificate ID (out parameter)
acPubKey - Generated access public key (out parameter)
tcbPubKey - Generated access public key (out parameter)
Author:
Pavel
See Also:
Cipherer

Err SWTCBWrapper::GetACPubKeys(const ACID acid, GMessage **acPubKey, GMessage **tcbPubKey)
Returns public keys. Returns both TCB and access certificate public keys identified by access certificate ID. The keys are searched for in certifTable.
Returns:
error code
Parameters:
acid - Access certificate ID to search by
acPubKey - Access public key (out parameter)
tcbPubKey - TCB public key (out parameter)
Author:
Pavel
See Also:
CertTableFindByACID()

MsgField* SWTCBWrapper::GetFileByFinderFID(const ACID acid, const MsgField *ffid, const GMessage *clientPubKey)
Pops file with ffid. Searches storageTable for files that have search file ID equal to ffid.
Returns:
File encrypted with clientPubKey, NULL otherwise
Parameters:
acid - Access certificate ID identifying TCB private key used to encrypt search file ID
ffid - Encrypted search file ID
clientPubKey - Client's public key to encrypt replies with
Author:
Pavel
See Also:
Cipherer

Queue* SWTCBWrapper::GetFileHeadersByFAM(const ACID acid, const MsgField *fam, const GMessage *clientPubKey)
Searches for file by file attribute mask. Searches through storageTable for files that are matching all criteria expressed in FAM - File Attribute Mask. This was designed to create simple extensions even for complex masks. Returns file descripting headers encrypted by clientPubKey.
Returns:
Queue with headers encrypted by clientPubKey, NULL otherwise
Parameters:
acid - Access certificate ID identifying TCB private key used to encrypt File Attribute Mask
fam - Encrypted File Attribute Mask to search by
clientPubKey - Client's public key to encrypt replies with
Author:
Pavel
See Also:
Keywords, DecryptByTCBPriv()

Err SWTCBWrapper::GetRingKeys(GMessage ** ringKeys)
Loads ring keys. Initializes ring keys for tables loading it from files, that are encrypted by master key (according to rules of hierarchical key management).
Returns:
error code
Parameters:
ringKeys - out parameter returning ring keys if successfull
Author:
Pavel
See Also:
Cipherer, MsgField, GMessage

Err SWTCBWrapper::InstantiateTCBTables(const GMessage *ringKeys)
Initializes all TCBTables. Creates instances for both storageTable and certifTable generating its definitions and using appropriate ring keys.
Returns:
error code
Parameters:
ringKeys - ring keys for TCBTable constructors
Author:
Pavel
See Also:
TCBTable, TableFieldQueue

Err SWTCBWrapper::LoadMasterKey()
Loads master key. Initializes masterKey of key hierarchy loading it from a file.
Returns:
error code
Author:
Pavel
See Also:

Err SWTCBWrapper::RefreshMasterKey()
Create new master key and reencrypt the file that stores ring keys. Create new master key and reencrypt the file that stores ring keys.
Returns:
error code
Author:
Pavel
See Also:
Cipherer

Err SWTCBWrapper::RefreshRingKeys()
Create new ring keys and reencrypt certifTable and certifTable. Create new ring keys and reencrypt certifTable and certifTable.
Returns:
error code
Author:
Pavel
See Also:
Cipherer

Err SWTCBWrapper::RemoveACKeys(const ACID acid)
Removes access certificate keys. Removes both TCB and access certificate key pairs from certifTable.
Returns:
error code
Parameters:
acid - Access certificate ID identifying keys to remove
Author:
Pavel
See Also:
CertTableFindByACID()

Err SWTCBWrapper::Rollback(const TID tid)
Rolls back a transaction. Rollback of a transaction means deletion of file stored with same ID as is ID of that transaction.
Returns:
error code
Parameters:
tid - ID of a transaction to rollback
Author:
Pavel
See Also:
Rollbackable, DeleteFileByFileID()

SWTCBWrapper::SWTCBWrapper(Eso *anEso, LogFile *aLogFile)
SWTCBWrapper constructor. Restores the MasterKey, decrypts ringKeys, instantiates TCBTables.
Parameters:
anEso - pointer to owner of this class
aLogFile - log file for debugging messages
Author:
Pavel
See Also:
Eso

Err SWTCBWrapper::SaveFile(const ACID acid, const ID fid, const MsgField *ffid, const MsgField *keywords, const MsgField *data)
Saves file. Prepares file for saving: decrypting it by TCB private key and encrypting with a newly generated symetric storage key. Then it puts all information (prepared the same way) together to storageTable.
Returns:
error code
Parameters:
acid - Access certificate ID
fid - file ID of file to save
ffid - search file ID of file to save
keywords - keywords for file to save
data - to save
Author:
Pavel
See Also:
Cipherer, StorTableInsert()

Err SWTCBWrapper::StorTableFindByFFID( const MsgField *ffid, Char **fileName, GMessage **storageKey, Keywords **keywords, Size *size)
Finds record in storageTable. Searches open table for appearance of record with appropriate search file ID.
Returns:
error code
Parameters:
ffid - search file ID to search by
fileName - name of save file (out parameter)
storageKey - symetric key used to encrypt saved file (out parameter)
keywords - keywords for saved file (out parameter)
size - size of saved file (out parameter)
Author:
Pavel
See Also:

Err SWTCBWrapper::StorTableFindByFID( const ID fid, const Int shouldClose, Char **fileName, GMessage **storageKey)
Finds record in storageTable. Searches open table for appearance of record with appropriate file ID. Enables to close storageTable after successfull search.
Returns:
error code
Parameters:
fid - file ID to search by
shouldClose - Should I close the storageTable, after I'm finished?
fileName - name of save file (out parameter)
storageKey - symetric key used to encrypt saved file (out parameter)
Author:
Pavel
See Also:

Err SWTCBWrapper::StorTableInsert( const ID fid, const MsgField *ffid, const Char *fileName, const GMessage *storageKey, const MsgField *keywords, const Size fileSize)
Inserts record to storageTable. Creates new Record for storageTable, fills it with given arguments and inserts it to storageTable.
Returns:
error code
Parameters:
fid - file ID of saved file
ffid - search file ID of saved file
fileName - name of save file
storageKey - symetric key used to encrypt saved file
keywords - keywords for saved file
fileSize - size of saved file
Author:
Pavel
See Also:
TCBTable

Err SWTCBWrapper::StorTableParseRecord(const Record *storRec, ID *fid, MsgField **ffid, Char **fileName, GMessage **storageKey, Keywords **keywords, Size *fileSize)
Parses record got from storageTable. Parses record that was got from storageTable filling out parameters.
Returns:
error code
Parameters:
storRec - record read from storTable
fid - file ID of saved file (out parameter)
ffid - search file ID of saved file (out parameter)
fileName - name of save file (out parameter)
storageKey - symetric key used to encrypt saved file (out parameter)
keywords - keywords for saved file (out parameter)
fileSize - size of saved file (out parameter)
Author:
Pavel
See Also:
Record, TableField

SWTCBWrapper::~SWTCBWrapper()
SWTCBWrapper destructor. Destroyes all created objects.
Author:
Pavel
See Also:


This class has no child classes.
Author:
Pavel
See Also:
TCBWrapper, Eso

alphabetic index hierarchy of classes


generated by doc++