Fix warning related mandatory comments
[platform/core/csapi/security.git] / Tizen.Security.SecureRepository / Tizen.Security.SecureRepository / Manager.cs
1 /*
2  *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  */
16
17 namespace Tizen.Security.SecureRepository
18 {
19     /// <summary>
20     /// This class is a base class of XxxManager classes. It provides the common methods for all sub classes.
21     /// </summary>
22     public class Manager
23     {
24         // ckmc_owner_id_separator
25         // ckmc_owner_id_system
26
27         /// <summary>
28         /// Separator between alias and owner id.
29         /// </summary>
30         /// <remarks>
31         /// Alias can be provided as an alias alone, or together with owner id. 
32         /// In this case, separator " " (space bar) is used to separate id and alias.
33         /// </remarks>
34         public const string OwnerIdSeperator = " ";
35
36         /// <summary>
37         /// The owner of system database.
38         /// </summary>
39         /// <remarks>
40         /// SystemOwnerId constains id connected with all SYSTEM applications that run
41         /// with uid less than 5000.
42         /// Client should use SystemOwnerId to access data owned by system application
43         /// and stored in system database.
44         /// Note: Client must have permission to access proper row.
45         /// </remarks>
46         public const string SystemOwnerId = "/System";
47
48         /// <summary>
49         /// Removes a an entry (no matter of type) from the key manager.
50         /// </summary>
51         /// <param name="alias">Item alias to be removed.</param>
52         /// <remarks>To remove item, client must have remove permission to the specified item.</remarks>
53         /// <remarks>The item owner can remove by default.</remarks>
54         static public void RemoveAlias(string alias)
55         {
56             int ret = Interop.CkmcManager.RemoveAlias(alias);
57             Interop.CheckNThrowException(ret, "Failed to remove alias. alias=" + alias);
58         }
59
60         /// <summary>
61         /// Allows another application to access client's application data.
62         /// </summary>
63         /// <param name="alias">Item alias for which access will be granted.</param>
64         /// <param name="otherPackageId">Package id of the application that will gain access rights.</param>
65         /// <param name="permissions">Mask of permissions(Permission enum) granted for an application with otherPackageId.</param>
66         /// <remarks>Data identified by alias should exist.</remarks>
67         /// <remarks>The item owner can set permissions.</remarks>
68         static public void SetPermission(string alias, string otherPackageId, int permissions)
69         {
70             int ret = Interop.CkmcManager.SetPermission(alias, otherPackageId, permissions);
71             Interop.CheckNThrowException(ret, "Failed to set permission. alias=" + alias);
72         }
73     }
74 }