class TSecurityPolicy |
Class representing a generic security policy
This class can specify a security policy consisting of either:
A check for between 0 and 7 capabilities
A check for a given Secure ID along with 0-3 capabilities
A check for a given Vendor ID along with 0-3 capabilities
If multiple capabilities are specified, all of them must be present for the security check to succeed ('AND' relation).
Publish and Subscribe properties
DBMS databases
In these cases the owning client would pass one (or more) of these objects to the server to specify which security checks should be done on other clients before allowing access to the object.
To pass a TSecurityPolicy object via IPC, a client should obtain a descriptor for the object using Package() and send this. When a server receives this descriptor it should read the descriptor contents into a TSecurityPolicyBuf and then Set() should be used to create a policy object from this.
Because this class has non-default constructors, compilers will not initialise this object at compile time, instead code will be generated to construct the object at run-time. This is wasteful - and Symbian OS DLLs are not permitted to have such uninitialised data. To overcome these problems a set of macros are provided to construct a const object which behaves like a TSecurityPolicy . These are:
_LIT_SECURITY_POLICY_C1 through _LIT_SECURITY_POLICY_C7, _LIT_SECURITY_POLICY_S0 through _LIT_SECURITY_POLICY_S3 and _LIT_SECURITY_POLICY_V0 through _LIT_SECURITY_POLICY_V3.
Also, the macros _LIT_SECURITY_POLICY_PASS and _LIT_SECURITY_POLICY_FAIL are provided in order to allow easy construction of a const object which can be used as a TSecuityPolicy which always passes or always fails, respectively.
If a security policy object is needed to be embedded in another class then the TStaticSecurityPolicy structure can be used. This behaves in the same way as a TSecurityPolicy object but may be initialised at compile time.
TStaticSecurityPolicy TSecurityPolicyBuf _LIT_SECURITY_POLICY_PASS _LIT_SECURITY_POLICY_FAIL _LIT_SECURITY_POLICY_C1 _LIT_SECURITY_POLICY_C2 _LIT_SECURITY_POLICY_C3 _LIT_SECURITY_POLICY_C4 _LIT_SECURITY_POLICY_C5 _LIT_SECURITY_POLICY_C6 _LIT_SECURITY_POLICY_C7 _LIT_SECURITY_POLICY_S0 _LIT_SECURITY_POLICY_S1 _LIT_SECURITY_POLICY_S2 _LIT_SECURITY_POLICY_S3 _LIT_SECURITY_POLICY_V0 _LIT_SECURITY_POLICY_V1 _LIT_SECURITY_POLICY_V2 _LIT_SECURITY_POLICY_V3
Public Member Functions | |
---|---|
TSecurityPolicy () | |
TSecurityPolicy ( TSecPolicyType ) | |
TSecurityPolicy ( TCapability , TCapability , TCapability ) | |
TSecurityPolicy ( TCapability , TCapability , TCapability , TCapability , TCapability , TCapability , TCapability ) | |
TSecurityPolicy ( TSecureId , TCapability , TCapability , TCapability ) | |
TSecurityPolicy ( TVendorId , TCapability , TCapability , TCapability ) | |
TBool | CheckPolicy ( RProcess , const char *) |
TBool | CheckPolicy ( RThread , const char *) |
TBool | CheckPolicy ( RMessagePtr2 , const char *) |
TBool | CheckPolicy ( RMessagePtr2 , TSecurityInfo &, const char *) |
TInt | CheckPolicy ( RSessionBase ) |
TBool | CheckPolicyCreator (const char *) |
IMPORT_C TPtrC8 | Package () |
IMPORT_C TInt | Set (const TDesC8 &) |
TBool | Validate () |
Protected Member Functions | |
---|---|
TBool | CheckPolicy (const SSecurityInfo &, SSecurityInfo &) |
Private Member Functions | |
---|---|
void | ConstructAndCheck3 ( TCapability , TCapability , TCapability ) |
IMPORT_C TBool | DoCheckPolicy ( RProcess , const char *) |
IMPORT_C TBool | DoCheckPolicy ( RProcess ) |
IMPORT_C TBool | DoCheckPolicy ( RThread , const char *) |
IMPORT_C TBool | DoCheckPolicy ( RThread ) |
IMPORT_C TBool | DoCheckPolicy ( RMessagePtr2 , const char *) |
IMPORT_C TBool | DoCheckPolicy ( RMessagePtr2 ) |
TBool | DoCheckPolicy ( RMessagePtr2 , TSecurityInfo &, const char *) |
TBool | DoCheckPolicy ( RMessagePtr2 , TSecurityInfo &) |
IMPORT_C TBool | DoCheckPolicyCreator (const char *) |
IMPORT_C TBool | DoCheckPolicyCreator () |
Public Member Enumerations | |
---|---|
enum | TSecPolicyType { EAlwaysFail = 0, EAlwaysPass = 1 } |
enum |
TType
{
ETypeFail = 0, ETypePass = 1, ETypeC3 = 2, ETypeC7 = 3, ETypeS3 = 4, ETypeV3 = 5, ETypeLimit } |
Public Attributes | |
---|---|
TUint8 | iExtraCaps |
TUint32 | iSecureId |
TUint32 | iVendorId |
Private Attributes | |
---|---|
union TSecurityPolicy::@15 | @16 |
TUint8 | iCaps |
TUint8 | iType |
TSecurityPolicy | ( | ) | [inline] |
Constructs a TSecurityPolicy that will always fail, irrespective of the checked object's attributes.
IMPORT_C | TSecurityPolicy | ( | TSecPolicyType | aType | ) |
TSecPolicyType aType | Must be one of EAlwaysPass or EAlwaysFail |
IMPORT_C | TSecurityPolicy | ( | TCapability | aCap1, |
TCapability | aCap2 = ECapability_None, | |||
TCapability | aCap3 = ECapability_None | |||
) |
TCapability aCap1 | The first capability to add to this policy |
TCapability aCap2 = ECapability_None | An optional second capability to add to this policy |
TCapability aCap3 = ECapability_None | An optional third capability to add to this policy |
IMPORT_C | TSecurityPolicy | ( | TCapability | aCap1, |
TCapability | aCap2, | |||
TCapability | aCap3, | |||
TCapability | aCap4, | |||
TCapability | aCap5 = ECapability_None, | |||
TCapability | aCap6 = ECapability_None, | |||
TCapability | aCap7 = ECapability_None | |||
) |
TCapability aCap1 | The first capability to add to this policy |
TCapability aCap2 | The second capability to add to this policy |
TCapability aCap3 | The third capability to add to this policy |
TCapability aCap4 | The fourth capability to add to this policy |
TCapability aCap5 = ECapability_None | An optional fifth capability to add to this policy |
TCapability aCap6 = ECapability_None | An optional sixth capability to add to this policy |
TCapability aCap7 = ECapability_None | An optional seventh capability to add to this policy |
IMPORT_C | TSecurityPolicy | ( | TSecureId | aSecureId, |
TCapability | aCap1 = ECapability_None, | |||
TCapability | aCap2 = ECapability_None, | |||
TCapability | aCap3 = ECapability_None | |||
) |
TSecureId aSecureId | The secure id to add to this policy |
TCapability aCap1 = ECapability_None | The first capability to add to this policy |
TCapability aCap2 = ECapability_None | The second capability to add to this policy |
TCapability aCap3 = ECapability_None | The third capability to add to this policy |
IMPORT_C | TSecurityPolicy | ( | TVendorId | aVendorId, |
TCapability | aCap1 = ECapability_None, | |||
TCapability | aCap2 = ECapability_None, | |||
TCapability | aCap3 = ECapability_None | |||
) |
TVendorId aVendorId | The vendor id to add to this policy |
TCapability aCap1 = ECapability_None | The first capability to add to this policy |
TCapability aCap2 = ECapability_None | The second capability to add to this policy |
TCapability aCap3 = ECapability_None | The third capability to add to this policy |
TBool | CheckPolicy | ( | RProcess | aProcess, |
const char * | aDiagnostic = 0 | |||
) | const [inline] |
Checks this policy against the platform security attributes of aProcess.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RProcess aProcess | The RProcess object to check against this TSecurityPolicy. |
const char * aDiagnostic = 0 | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
TBool | CheckPolicy | ( | RThread | aThread, |
const char * | aDiagnostic = 0 | |||
) | const [inline] |
Checks this policy against the platform security attributes of the process owning aThread.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RThread aThread | The thread whose owning process' platform security attributes are to be checked against this TSecurityPolicy. |
const char * aDiagnostic = 0 | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
TBool | CheckPolicy | ( | RMessagePtr2 | aMsgPtr, |
const char * | aDiagnostic = 0 | |||
) | const [inline] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
const char * aDiagnostic = 0 | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
TBool | CheckPolicy | ( | RMessagePtr2 | aMsgPtr, |
TSecurityInfo & | aMissing, | |||
const char * | aDiagnostic = 0 | |||
) | const [inline] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
TSecurityInfo & aMissing | A TSecurityInfo object which this method fills with any capabilities or IDs it finds to be missing. |
const char * aDiagnostic = 0 | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
TInt | CheckPolicy | ( | RSessionBase | aSession | ) | const |
RSessionBase aSession |
TBool | CheckPolicy | ( | const SSecurityInfo & | aSecInfo, |
SSecurityInfo & | aMissing | |||
) | const [protected] |
const SSecurityInfo & aSecInfo | The SSecurityInfo object to check against this TSecurityPolicy. |
SSecurityInfo & aMissing | A SSecurityInfo object which this method fills with any capabilities or IDs it finds to be missing. This is designed to help generating diagnostic messages. |
TBool | CheckPolicyCreator | ( | const char * | aDiagnostic = 0 | ) | const [inline] |
Checks this policy against the platform security attributes of this process' creator.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
const char * aDiagnostic = 0 | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
void | ConstructAndCheck3 | ( | TCapability | aCap1, |
TCapability | aCap2, | |||
TCapability | aCap3 | |||
) | [private] |
TCapability aCap1 | |
TCapability aCap2 | |
TCapability aCap3 |
IMPORT_C TBool | DoCheckPolicy | ( | RProcess | aProcess, |
const char * | aDiagnostic | |||
) | const [private] |
Checks this policy against the platform security attributes of aProcess.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RProcess aProcess | The RProcess object to check against this TSecurityPolicy. |
const char * aDiagnostic | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
IMPORT_C TBool | DoCheckPolicy | ( | RProcess | aProcess | ) | const [private] |
Checks this policy against the platform security attributes of aProcess.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RProcess aProcess | The RProcess object to check against this TSecurityPolicy. |
IMPORT_C TBool | DoCheckPolicy | ( | RThread | aThread, |
const char * | aDiagnostic | |||
) | const [private] |
Checks this policy against the platform security attributes of the process owning aThread.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RThread aThread | The thread whose owning process' platform security attributes are to be checked against this TSecurityPolicy. |
const char * aDiagnostic | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
IMPORT_C TBool | DoCheckPolicy | ( | RThread | aThread | ) | const [private] |
Checks this policy against the platform security attributes of the process owning aThread.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RThread aThread | The thread whose owning process' platform security attributes are to be checked against this TSecurityPolicy. |
IMPORT_C TBool | DoCheckPolicy | ( | RMessagePtr2 | aMsgPtr, |
const char * | aDiagnostic | |||
) | const [private] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
const char * aDiagnostic | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
IMPORT_C TBool | DoCheckPolicy | ( | RMessagePtr2 | aMsgPtr | ) | const [private] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
TBool | DoCheckPolicy | ( | RMessagePtr2 | aMsgPtr, |
TSecurityInfo & | aMissing, | |||
const char * | aDiagnostic | |||
) | const [private] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
TSecurityInfo & aMissing | A TSecurityInfo object which this method fills with any capabilities or IDs it finds to be missing. |
const char * aDiagnostic | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
TBool | DoCheckPolicy | ( | RMessagePtr2 | aMsgPtr, |
TSecurityInfo & | aMissing | |||
) | const [private] |
Checks this policy against the platform security attributes of the process which sent the given message.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
RMessagePtr2 aMsgPtr | The RMessagePtr2 object to check against this TSecurityPolicy. |
TSecurityInfo & aMissing | A TSecurityInfo object which this method fills with any capabilities or IDs it finds to be missing. |
IMPORT_C TBool | DoCheckPolicyCreator | ( | const char * | aDiagnostic | ) | const [private] |
Checks this policy against the platform security attributes of this process' creator.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
const char * aDiagnostic | A string that will be emitted along with any diagnostic message that may be issued if the policy check fails. This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro which enables it to be easily removed from the system. |
IMPORT_C TBool | DoCheckPolicyCreator | ( | ) | const [private] |
Checks this policy against the platform security attributes of this process' creator.
When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.
IMPORT_C TPtrC8 | Package | ( | ) | const |
Constructs a TPtrC8 wrapping the platform security attributes of this TSecurityPolicy . Such a descriptor is suitable for passing across the client server boundary.
The format of the descriptor is determined by the first byte which specifies the type of this TSecurityPolicy . The first byte is one of the constants specified in the enum TSecurityPolicy::TType .
TUint8 iType; // set to ETypeC3, ETypeS3, ETypePass or ETypeFail TUint8 iCaps[3]; TUint32 iSecureId;ETypeC3 descriptors will contain capabilities in iCaps but have iSecureId set to ECapability_None. ETypeS3 are similar to ETypeC3 descriptors but will have iSecureId set to the secure ID value of the TSecurityPolicy object. ETypePass and ETypeFail objects will have values of all of the elements of iCaps and iSecureId set to ECapability_None.
TUint8 iType; // set to ETypeV3 TUint8 iCaps[3]; // set to the values of 3 capabilities TUint32 iVendorId; // set to the value of the vendor ID of the TSecurityPolicy
TUint8 iType; // set to ETypeC7 TUint8 iCaps[3]; // set to the values of 3 of the objects capabilities TUint8 iExtraCaps[4]; // set to the values of 4 of the objects capabilitiesTSecurityPolicy::TType TSecurityPolicy::Set()
IMPORT_C TInt | Set | ( | const TDesC8 & | aDes | ) |
Sets this TSecurityPolicy to a copy of the policy described by the supplied descriptor. Such a descriptor can be obtained from TSecurityPolicy::Package() . TSecurityPolicy::Package()
const TDesC8 & aDes | A descriptor representing the state of another TSecurityPolicy. |
Constants to specify the type of TSecurityPolicy objects.
ETypeFail = 0 |
Always fail |
ETypePass = 1 |
Always pass |
ETypeC3 = 2 |
Up to 3 capabilities |
ETypeC7 = 3 |
Up to 7 capabilities |
ETypeS3 = 4 |
Secure ID and up to 3 capabilities |
ETypeV3 = 5 |
Vendor ID and up to 3 capabilities |
ETypeLimit |
The number of possible TSecurityPolicy types This is intended for internal Symbian use only. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.