MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / WritePolicyText

Method WritePolicyText

src/tw/twutil.cpp:679–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677// Will throw eError on failure.
678
679void 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///////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 4

WriteObjectFunction · 0.85
NotifyMethod · 0.80
c_strMethod · 0.80
SetIDMethod · 0.45

Tested by

no test coverage detected