////////////////////////////////////////////////////////////////////////// ReadPolicyText Read the policy file. Read the text of a policy language into configText Will throw eError on failure. //////////////////////////////////////////////////////////////////////////
| 707 | // Will throw eError on failure. |
| 708 | /////////////////////////////////////////////////////////////////////////////// |
| 709 | void cTWUtil::ReadPolicyText(const TCHAR* filename, std::string& polText, const cElGamalSigPublicKey* pPublicKey) |
| 710 | { |
| 711 | cSerializableNString nstring; |
| 712 | |
| 713 | cFileUtil::TestFileExists(filename); |
| 714 | |
| 715 | bool bEncrypted; |
| 716 | ReadObject(filename, NULL, nstring, cPolicyFile::GetFileHeaderID(), pPublicKey, bEncrypted); |
| 717 | |
| 718 | // check 8 byte header |
| 719 | if (nstring.mString.compare(0, 8 * sizeof(byte), POLICY_FILE_MAGIC_8BYTE) != 0) |
| 720 | ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename, eSerializer::TY_FILE)); |
| 721 | |
| 722 | // remove 8 byte header |
| 723 | nstring.mString.assign(nstring.mString.substr(8)); |
| 724 | |
| 725 | polText = nstring.mString; |
| 726 | } |
| 727 | |
| 728 | |
| 729 | /////////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected