[runtime] Rename most System.Reflection.MonoX classes to RuntimeX for consistency...
[mono-project.git] / mono / metadata / security-manager.h
blobe389769ac1d4d979db5be25cf02868674580d5f3
1 /**
2 * \file
3 * Security Manager
5 * Author:
6 * Sebastien Pouliot <sebastien@ximian.com>
8 * Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
9 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
12 #ifndef _MONO_METADATA_SECURITY_MANAGER_H_
13 #define _MONO_METADATA_SECURITY_MANAGER_H_
15 #include <string.h>
17 #include "object.h"
18 #include "metadata-internals.h"
19 #include "domain-internals.h"
20 #include "tokentype.h"
21 #include "threads.h"
22 #include "marshal.h"
23 #include "image.h"
24 #include "reflection.h"
25 #include "tabledefs.h"
26 #include <mono/metadata/icalls.h>
28 /* Definitions */
30 #define MONO_ECMA_KEY_LENGTH 16
31 #define MONO_PUBLIC_KEY_HEADER_LENGTH 32
32 #define MONO_MINIMUM_PUBLIC_KEY_LENGTH 48
33 #define MONO_DEFAULT_PUBLIC_KEY_LENGTH 128
35 #define MONO_PUBLIC_KEY_BIT_SIZE(x) ((x - MONO_PUBLIC_KEY_HEADER_LENGTH) << 3)
37 enum {
38 MONO_METADATA_SECURITY_OK = 0x00,
39 MONO_METADATA_INHERITANCEDEMAND_CLASS = 0x01,
40 MONO_METADATA_INHERITANCEDEMAND_METHOD = 0x02
43 typedef enum {
44 MONO_SECURITY_MODE_NONE,
45 MONO_SECURITY_MODE_CORE_CLR,
46 } MonoSecurityMode;
48 /* Structures */
50 typedef struct {
51 MonoClass *securitymanager; /* System.Security.SecurityManager */
52 } MonoSecurityManager;
54 gboolean mono_is_ecma_key (const char *publickey, int size);
55 MonoMethod* mono_get_context_capture_method (void);
57 MonoSecurityManager* mono_security_manager_get_methods (void);
59 /* Security mode */
60 void mono_security_set_mode (MonoSecurityMode mode);
61 MonoSecurityMode mono_security_get_mode (void);
63 /* internal calls */
64 ICALL_EXPORT
65 MonoBoolean ves_icall_System_Security_SecurityManager_get_SecurityEnabled (void);
67 ICALL_EXPORT
68 void ves_icall_System_Security_SecurityManager_set_SecurityEnabled (MonoBoolean value);
70 #ifndef DISABLE_SECURITY
71 #define mono_security_core_clr_enabled() (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
72 #else
73 #define mono_security_core_clr_enabled() (FALSE)
74 #endif
76 #endif /* _MONO_METADATA_SECURITY_MANAGER_H_ */