| 677 | // Will throw eError on failure. |
| 678 | |
| 679 | void cTWUtil::WritePolicyText(const TCHAR* filename, |
| 680 | const std::string& polText, |
| 681 | bool bEncrypt, |
| 682 | const cElGamalSigPrivateKey* pPrivateKey) |
| 683 | { |
| 684 | cSerializableNString nstring; |
| 685 | |
| 686 | // add a 8 byte header we can use to verify decryption |
| 687 | nstring.mString = POLICY_FILE_MAGIC_8BYTE; |
| 688 | |
| 689 | nstring.mString += polText; |
| 690 | |
| 691 | cFileHeader fileHeader; |
| 692 | fileHeader.SetID(cPolicyFile::GetFileHeaderID()); |
| 693 | |
| 694 | WriteObject(filename, NULL, nstring, fileHeader, bEncrypt, pPrivateKey); |
| 695 | |
| 696 | iUserNotify::GetInstance()->Notify(iUserNotify::V_NORMAL, |
| 697 | _T("%s%s\n"), |
| 698 | TSS_GetString(cTW, tw::STR_WRITE_POLICY_FILE).c_str(), |
| 699 | cDisplayEncoder::EncodeInline(filename).c_str()); |
| 700 | } |
| 701 | |
| 702 | |
| 703 | /////////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected