TrustedApplication.h [plain text]
#ifndef _SECURITY_TRUSTEDAPPLICATION_H_
#define _SECURITY_TRUSTEDAPPLICATION_H_
#include <Security/SecTrustedApplication.h>
#include <security_cdsa_utilities/cssmdata.h>
#include <security_cdsa_utilities/cssmaclpod.h>
#include <security_cdsa_utilities/acl_codesigning.h>
#include <security_utilities/seccfobject.h>
#include "SecCFTypes.h"
namespace Security {
namespace KeychainCore {
class TrustedApplication : public SecCFObject {
NOCOPY(TrustedApplication)
public:
SECCFFUNCTIONS(TrustedApplication, SecTrustedApplicationRef, errSecInvalidItemRef, gTypes().TrustedApplication)
TrustedApplication(const TypedList &subject); TrustedApplication(const std::string &path); TrustedApplication(); TrustedApplication(const std::string &path, SecRequirementRef requirement); TrustedApplication(CFDataRef external); ~TrustedApplication();
const char *path() const { return mForm->path().c_str(); }
CssmData legacyHash() const { return CssmData::wrap(mForm->legacyHash(), SHA1::digestLength); }
SecRequirementRef requirement() const { return mForm->requirement(); }
void data(CFDataRef data);
CFDataRef externalForm() const;
CssmList makeSubject(Allocator &allocator);
bool verifyToDisk(const char *path);
private:
RefPointer<CodeSignatureAclSubject> mForm;
};
class PathDatabase {
public:
PathDatabase(const char *path = "/var/db/CodeEquivalenceCandidates");
bool operator [] (const std::string &path)
{ return mQualifyAll || lookup(path); }
private:
bool mQualifyAll;
set<std::string> mPaths;
bool lookup(const std::string &path);
};
} }
#endif // !_SECURITY_TRUSTEDAPPLICATION_H_