2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 namespace Tizen.Security.SecureRepository
20 /// This class is a base class of XxxManager classes. It provides the common methods for all sub classes.
24 // ckmc_owner_id_separator
25 // ckmc_owner_id_system
28 /// Separator between alias and owner id.
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.
34 public const string OwnerIdSeperator = " ";
37 /// The owner of system database.
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.
46 public const string SystemOwnerId = "/System";
49 /// Removes a an entry (no matter of type) from the key manager.
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)
56 int ret = Interop.CkmcManager.RemoveAlias(alias);
57 Interop.CheckNThrowException(ret, "Failed to remove alias. alias=" + alias);
61 /// Allows another application to access client's application data.
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)
70 int ret = Interop.CkmcManager.SetPermission(alias, otherPackageId, permissions);
71 Interop.CheckNThrowException(ret, "Failed to set permission. alias=" + alias);