### Security Manager

### Declarative Security

`mono_declsec_flags_from_assembly`
Syntax
guint32 mono_declsec_flags_from_assembly (MonoAssembly *assembly)

Parameters

assembly | The assembly for which we want the declarative security flags.

Return value
the declarative security flags for the assembly.
Description
Get the security actions (in the form of flags) associated with the specified assembly.
`mono_declsec_flags_from_class`
Syntax
guint32 mono_declsec_flags_from_class (MonoClass *klass)

Parameters

klass | The class for which we want the declarative security flags.

Return value
the declarative security flags for the class.
Description
Get the security actions (in the form of flags) associated with the specified class. We cache the flags inside the `MonoClass` structure as this will get called very often (at least for each method).
`mono_declsec_flags_from_method`
Syntax
guint32 mono_declsec_flags_from_method (MonoMethod *method)

Parameters

method | The method for which we want the declarative security flags.

Return value
the declarative security flags for the method (only).
Description
Get the security actions (in the form of flags) associated with the specified method. To keep `MonoMethod` size down we do not cache the declarative security flags (except for the stack modifiers which are kept in the MonoJitInfo structure)
`mono_declsec_get_assembly_action`
Syntax
MonoBoolean mono_declsec_get_assembly_action (MonoAssembly *assembly, guint32 action, MonoDeclSecurityEntry *entry)

`mono_declsec_get_class_action`
Syntax
MonoBoolean mono_declsec_get_class_action (MonoClass *klass, guint32 action, MonoDeclSecurityEntry *entry)

`mono_declsec_get_demands`
Syntax
MonoBoolean mono_declsec_get_demands (MonoMethod *method, MonoDeclSecurityActions* demands)

Description
Collect all actions (that requires to generate code in mini) assigned for the specified method. Don't use the content of actions if the function return `FALSE`.
`mono_declsec_get_inheritdemands_class`
Syntax
MonoBoolean mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions* demands)

Parameters

klass | The inherited class - this is the class that provides the security check (attributes)
demands |

Return value
`TRUE` if inheritance demands (any kind) are present, `FALSE` otherwise.
Description
Collect all Inherit actions - `InheritanceDemand`, `NonCasInheritanceDemand` and `InheritanceDemandChoice` (2.0). Don't use the content of actions if the function return `FALSE`.
`mono_declsec_get_inheritdemands_method`
Syntax
MonoBoolean mono_declsec_get_inheritdemands_method (MonoMethod *method, MonoDeclSecurityActions* demands)

Parameters

actions | `InheritanceDemand`, `NonCasInheritanceDemand` and `InheritanceDemandChoice` (2.0).

Description
Don't use the content of actions if the function return `FALSE`.
`mono_declsec_get_linkdemands`
Syntax
MonoBoolean mono_declsec_get_linkdemands (MonoMethod *method, MonoDeclSecurityActions* klass, MonoDeclSecurityActions *cmethod)

Parameters

actions | `LinkDemand`, `NonCasLinkDemand` and `LinkDemandChoice` (2.0).

Description
Don't use the content of actions if the function return `FALSE`.