Microsoft Information Protection (MIP) SDK for C: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C
Loading...
Searching...
No Matches
protection_descriptor_cc.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27/**
28 * @brief Defines C-Style ProtectionDescriptor interface
29 *
30 * @file protection_descriptor_cc.h
31 */
32
33#ifndef API_MIP_PROTECTION_DESCRIPTOR_CC_H_
34#define API_MIP_PROTECTION_DESCRIPTOR_CC_H_
35
36#include <time.h>
37
40#include "mip_cc/error_cc.h"
41#include "mip_cc/result_cc.h"
44
48
49/**
50 * @brief A description of whether protection is defined by a template or ad-hoc
51 */
52typedef enum {
53 MIP_PROTECTION_TYPE_TEMPLATE_BASED = 0, /**< Based on an RMS template */
54 MIP_PROTECTION_TYPE_CUSTOM = 1, /**< Custom, ad-hoc protection */
56
57/**
58 * @brief A group of users and the rights associated with them
59 */
60typedef struct {
61 const char** users; /**< List of users */
62 int64_t usersCount; /**< Number of users */
63 const char** rights; /**< List of rights */
64 int64_t rightsCount; /**< Number of rights */
66
67/**
68 * @brief A group of users and the roles associated with them
69 */
70typedef struct {
71 const char** users; /**< List of users */
72 int64_t usersCount; /**< Number of users */
73 const char** roles; /**< List of roles */
74 int64_t rolesCount; /**< Number of roles */
76
77/**
78 * @brief Creates a protection descriptor whose access permissions are defined by an RMS template
79 *
80 * @param templateId Template ID
81 * @param signedAppData App-specific data (cleartext) that is signed into the publishing license
82 * @param protectionDescriptor [Output] Newly-created protection descriptor instance
83 * @param errorInfo [Output] (Optional) Failure info if operation result is error
84 *
85 * @return Result code indicating success or failure
86 */
87MIP_CC_API(mip_cc_result) MIP_CC_CreateProtectionDescriptorFromTemplate(
88 const char* templateId,
92
93/**
94 * @brief Creates a protection descriptor whose access permissions are defined by users and rights
95 *
96 * @param userRights Groups of users and their rights
97 * @param userRightsCount Number of user/rights groups
98 * @param name Protection name
99 * @param referrer Referrer address (a URI displayable to a user that provides information on how to gain access)
100 * @param contentValidUntil Protection expiration time
101 * @param allowOfflineAccess Determines whether a license to consume content can be cached locally
102 * @param encryptedAppData App-specific data (cleartext) that is encrypted into the publishing license
103 * @param signedAppData App-specific data (cleartext) that is signed into the publishing license
104 * @param protectionDescriptor [Output] Newly-created protection descriptor instance
105 * @param errorInfo [Output] (Optional) Failure info if operation result is error
106 *
107 * @return Result code indicating success or failure
108 */
109MIP_CC_API(mip_cc_result) MIP_CC_CreateProtectionDescriptorFromUserRights(
111 const int64_t userRightsCount,
112 const char* name,
113 const char* description,
114 const char* referrer,
115 const time_t* contentValidUntil,
121
122/**
123 * @brief Creates a protection descriptor whose access permissions are defined by users and roles
124 *
125 * @param userRoles Groups of users and their roles
126 * @param userRolesCount Number of user/roles groups
127 * @param name Protection policy name
128 * @param referrer Referrer address (a URI displayable to a user that provides information on how to gain access)
129 * @param contentValidUntil Protection expiration time
130 * @param allowOfflineAccess Determines whether a license to consume content can be cached locally
131 * @param encryptedAppData App-specific data (cleartext) that is encrypted into the publishing license
132 * @param signedAppData App-specific data (cleartext) that is signed into the publishing license
133 * @param protectionDescriptor [Output] Newly-created protection descriptor instance
134 * @param errorInfo [Output] (Optional) Failure info if operation result is error
135 *
136 * @return Result code indicating success or failure
137 */
138MIP_CC_API(mip_cc_result) MIP_CC_CreateProtectionDescriptorFromUserRoles(
140 const int64_t userRolesCount,
141 const char* name,
142 const char* description,
143 const char* referrer,
144 const time_t* contentValidUntil,
145 const bool allowOfflineAccess,
150
151/**
152 * @brief Gets type of protection, whether it is defined by an RMS template or not
153 *
154 * @param protectionDescriptor Descriptor associated with protected content
155 * @param protectionType [Output] Protection type
156 * @param errorInfo [Output] (Optional) Failure info if operation result is error
157 *
158 * @return Result code indicating success or failure
159 */
160MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetProtectionType(
164
165/**
166 * @brief Gets size of buffer required to store owner
167 *
168 * @param protectionDescriptor Descriptor associated with protected content
169 * @param ownerSize [Output] Size of buffer to hold owner (in number of chars)
170 * @param errorInfo [Output] (Optional) Failure info if operation result is error
171 *
172 * @return Result code indicating success or failure
173 */
174MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetOwnerSize(
176 int64_t* ownerSize,
178
179/**
180 * @brief Gets protection owner
181 *
182 * @param protectionDescriptor Descriptor associated with protected content
183 * @param ownerBuffer [Output] Buffer the owner will be copied into.
184 * @param ownerBufferSize Size (in number of chars) of the ownerBuffer.
185 * @param actualOwnerSize [Output] Number of chars written to the buffer
186 * @param errorInfo [Output] (Optional) Failure info if operation result is error
187 *
188 * @return Result code indicating success or failure
189 *
190 * @note If ownerBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
191 * actualOwnerSize will be set to the minimum required buffer size.
192 */
193MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetOwner(
196 const int64_t ownerBufferSize,
199
200/**
201 * @brief Gets size of buffer required to store name
202 *
203 * @param protectionDescriptor Descriptor associated with protected content
204 * @param nameSize [Output] Size of buffer to hold name (in number of chars)
205 * @param errorInfo [Output] (Optional) Failure info if operation result is error
206 *
207 * @return Result code indicating success or failure
208 */
209MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetNameSize(
211 int64_t* nameSize,
213
214/**
215 * @brief Gets protection name
216 *
217 * @param protectionDescriptor Descriptor associated with protected content
218 * @param nameBuffer [Output] Buffer the name will be copied into.
219 * @param nameBufferSize Size (in number of chars) of the nameBuffer.
220 * @param actualNameSize [Output] Number of chars written to the buffer
221 * @param errorInfo [Output] (Optional) Failure info if operation result is error
222 *
223 * @return Result code indicating success or failure
224 *
225 * @note If nameBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
226 * actualNameSize will be set to the minimum required buffer size.
227 */
228MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetName(
231 const int64_t nameBufferSize,
234
235/**
236 * @brief Gets size of buffer required to store description
237 *
238 * @param protectionDescriptor Descriptor associated with protected content
239 * @param descriptionSize [Output] Size of buffer to hold description (in number of chars)
240 * @param errorInfo [Output] (Optional) Failure info if operation result is error
241 *
242 * @return Result code indicating success or failure
243 */
244MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetDescriptionSize(
248
249/**
250 * @brief Gets protection description
251 *
252 * @param protectionDescriptor Descriptor associated with protected content
253 * @param descriptionBuffer [Output] Buffer the description will be copied into.
254 * @param descriptionBufferSize Size (in number of chars) of the descriptionBuffer.
255 * @param actualDescriptionSize [Output] Number of chars written to the buffer
256 * @param errorInfo [Output] (Optional) Failure info if operation result is error
257 *
258 * @return Result code indicating success or failure
259 *
260 * @note If descriptionBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
261 * actualDescriptionSize will be set to the minimum required buffer size.
262 */
263MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetDescription(
269
270/**
271 * @brief Gets template ID
272 *
273 * @param protectionDescriptor Descriptor associated with protected content
274 * @param templateId [Output] Template ID associated with protection
275 * @param errorInfo [Output] (Optional) Failure info if operation result is error
276 *
277 * @return Result code indicating success or failure
278 */
279MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetTemplateId(
283
284/**
285 * @brief Gets label ID
286 *
287 * @param protectionDescriptor Descriptor associated with protected content
288 * @param labelId [Output] Label ID associated with protection
289 * @param errorInfo [Output] (Optional) Failure info if operation result is error
290 *
291 * @return Result code indicating success or failure
292 */
293MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetLabelId(
297
298/**
299 * @brief Gets content ID
300 *
301 * @param protectionDescriptor Descriptor associated with protected content
302 * @param contentId [Output] Content ID associated with protection
303 * @param errorInfo [Output] (Optional) Failure info if operation result is error
304 *
305 * @note Publishing licenses will have this identifier surrounded by curly braces "{}".
306 * Those braces are removed from the value stored in contentId
307 *
308 * @return Result code indicating success or failure
309 */
310MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetContentId(
314
315/**
316 * @brief Gets whether or not content has an expiration time or not
317 *
318 * @param protectionDescriptor Descriptor associated with protected content
319 * @param doesContentExpire [Output] Whether or not content expires
320 * @param errorInfo [Output] (Optional) Failure info if operation result is error
321 *
322 * @return Result code indicating success or failure
323 */
324MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_DoesContentExpire(
328
329/**
330 * @brief Gets protection expiration time (in seconds since epoch)
331 *
332 * @param protectionDescriptor Descriptor associated with protected content
333 * @param contentValidUntil [Output] Content expiration time (in seconds since epoch)
334 * @param errorInfo [Output] (Optional) Failure info if operation result is error
335 *
336 * @return Result code indicating success or failure
337 */
338MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetContentValidUntil(
340 int64_t* contentValidUntil,
342
343/**
344 * @brief Gets whether or not offline access is allowed
345 *
346 * @param protectionDescriptor Descriptor associated with protected content
347 * @param doesAllowOfflineAccess [Output] Whether or not offline access is allowed
348 * @param errorInfo [Output] (Optional) Failure info if operation result is error
349 *
350 * @return Result code indicating success or failure
351 */
352MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_DoesAllowOfflineAccess(
356
357/**
358 * @brief Gets size of buffer required to store referrer
359 *
360 * @param protectionDescriptor Descriptor associated with protected content
361 * @param referrerSize [Output] Size of buffer to hold referrer (in number of chars)
362 * @param errorInfo [Output] (Optional) Failure info if operation result is error
363 *
364 * @return Result code indicating success or failure
365 */
366MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetReferrerSize(
368 int64_t* referrerSize,
370
371/**
372 * @brief Gets protection referrer
373 *
374 * @param protectionDescriptor Descriptor associated with protected content
375 * @param referrerBuffer [Output] Buffer the referrer will be copied into.
376 * @param referrerBufferSize Size (in number of chars) of the referrerBuffer.
377 * @param actualReferrerSize [Output] Number of chars written to the buffer
378 * @param errorInfo [Output] (Optional) Failure info if operation result is error
379 *
380 * @return Result code indicating success or failure
381 *
382 * @note If referrerBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
383 * actualReferrerSize will be set to the minimum required buffer size.
384 */
385MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetReferrer(
388 const int64_t referrerBufferSize,
391
392/**
393 * @brief Gets signed application data
394 *
395 * @param protectionDescriptor Descriptor associated with protected content
396 * @param signedAppData [Output] Dictionary of key value pairs that are signed as part of publishing license.
397 * It is the caller's responsibility to release this dictionary with MIP_CC_ReleaseDictionary
398 * @param errorInfo [Output] (Optional) Failure info if operation result is error
399 *
400 * @return Result code indicating success or failure
401 */
402MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetSignedAppData(
406
407/**
408 * @brief Gets encrypted application data
409 *
410 * @param protectionDescriptor Descriptor associated with protected content
411 * @param encryptedAppData [Output] Dictionary of key value pairs that are encrypted as part of publishing license.
412 * It is the caller's responsibility to release this dictionary with MIP_CC_ReleaseDictionary
413 * @param errorInfo [Output] (Optional) Failure info if operation result is error
414 *
415 * @return Result code indicating success or failure
416 */
417MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetEncryptedAppData(
421
422/**
423 * @brief Gets size of buffer required to store double key URL
424 *
425 * @param protectionDescriptor Descriptor associated with protected content
426 * @param url [Output] Size of buffer to hold double key URL (in number of chars)
427 * @param errorInfo [Output] (Optional) Failure info if operation result is error
428 *
429 * @return Result code indicating success or failure
430 */
431MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetDoubleKeyUrlSize(
433 int64_t* urlSize,
435
436/**
437 * @brief Gets double key URL
438 *
439 * @param protectionDescriptor Descriptor associated with protected content
440 * @param urlBuffer [Output] Buffer the url will be copied into.
441 * @param urlBufferSize Size (in number of chars) of the urlBuffer.
442 * @param actualUrlSize [Output] Number of chars written to the buffer
443 * @param errorInfo [Output] (Optional) Failure info if operation result is error
444 *
445 * @return Result code indicating success or failure
446 *
447 * @note If urlBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
448 * actualUrlSize will be set to the minimum required buffer size.
449 */
450MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetDoubleKeyUrl(
453 const int64_t urlBufferSize,
456
457/**
458 * @brief Gets list of users-to-rights mappings
459 *
460 * @param protectionDescriptor Descriptor associated with protected content
461 * @param userRights [Output] List of users-to-rights mappings.
462 * It is the caller's responsibility to release this list with MIP_CC_ReleaseUserRightsResult
463 * @param userRightsCount [Output] Number of user/rights groups
464 * @param errorInfo [Output] (Optional) Failure info if operation result is error
465 *
466 * @return Result code indicating success or failure
467 *
468 * @note The value of the UserRights property will be empty if the current user doesn't have access to this
469 * information (that is, if the user does not have the VIEWRIGHTSDATA right or is not the owner of the content).
470 */
471MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetUserRights(
474 int64_t* userRightsCount,
476
477/**
478 * @brief Gets List of users-to-roles mappings
479 *
480 * @param protectionDescriptor Descriptor associated with protected content
481 * @param userRoles [Output] Gets List of users-to-roles mappings.
482 * It is the caller's responsibility to release this list with MIP_CC_ReleaseUserRolesResult
483 * @param userRolesCount [Output] Number of user/roles groups
484 * @param errorInfo [Output] (Optional) Failure info if operation result is error
485 *
486 * @return Result code indicating success or failure
487 */
488MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetUserRoles(
491 int64_t* userRolesCount,
493
494/**
495 * @brief Gets the dynamic watermark
496 *
497 * @param protectionDescriptor The protection descriptor from which to retrieve the dynamic watermark
498 * @param dynamicWatermark [Output] The retrieved dynamic watermark (null if not present)
499 * @param errorInfo [Output] (Optional) Failure info if operation results is failure
500 *
501 * @return Result code indicating success or failure
502 *
503 * @note The returned 'dynamicWatermark' (mip_cc_dynamic_watermark*) must be freed by
504 * calling MIP_CC_ReleaseDynamicWatermark
505*/
506MIP_CC_API(mip_cc_result) MIP_CC_ProtectionDescriptor_GetDynamicWatermark(
510
511/**
512 * @brief Release resources associated with a protection descriptor
513 *
514 * @param protectionDescriptor Protection descriptor to be released
515 */
516MIP_CC_API(void) MIP_CC_ReleaseProtectionDescriptor(mip_cc_protection_descriptor protectionDescriptor);
517
518#endif // API_MIP_PROTECTION_DESCRIPTOR_CC_H_
A file Containing the common types used by the upe, file and protection modules.
Contains C API definitions for common string dictionary.
Error definition and functions.
const int64_t const char const char const char const time_t const bool const mip_cc_dictionary encryptedAppData
char * descriptionBuffer
int64_t * nameSize
mip_cc_handle * mip_cc_user_rights_result
mip_cc_dynamic_watermark * dynamicWatermark
const mip_cc_dictionary mip_cc_protection_descriptor mip_cc_error * errorInfo
char const int64_t int64_t * actualUrlSize
const mip_cc_dictionary mip_cc_protection_descriptor * protectionDescriptor
mip_cc_guid * contentId
mip_cc_handle * mip_cc_user_roles_result
char * referrerBuffer
char const int64_t int64_t * actualOwnerSize
mip_cc_protection_type
A description of whether protection is defined by a template or ad-hoc.
@ MIP_PROTECTION_TYPE_CUSTOM
Custom, ad-hoc protection.
@ MIP_PROTECTION_TYPE_TEMPLATE_BASED
Based on an RMS template.
char const int64_t int64_t * actualReferrerSize
const mip_cc_dictionary signedAppData
char const int64_t referrerBufferSize
const int64_t const char const char const char const time_t const bool allowOfflineAccess
mip_cc_user_rights_result * userRights
char const int64_t int64_t * actualNameSize
int64_t * descriptionSize
mip_cc_guid * labelId
bool * doesAllowOfflineAccess
const int64_t const char const char const char * referrer
bool * doesContentExpire
char const int64_t urlBufferSize
char * urlBuffer
const int64_t userRightsCount
int64_t * urlSize
int64_t * ownerSize
char * ownerBuffer
char const int64_t nameBufferSize
int64_t * referrerSize
mip_cc_handle * mip_cc_protection_descriptor
char const int64_t int64_t * actualDescriptionSize
const int64_t const char const char const char const time_t * contentValidUntil
mip_cc_guid * templateId
char const int64_t descriptionBufferSize
const int64_t const char const char * description
char * nameBuffer
mip_cc_user_roles_result * userRoles
MIP_CC_API(void) MIP_CC_ReleaseProtectionDescriptor(mip_cc_protection_descriptor protectionDescriptor)
Release resources associated with a protection descriptor.
char const int64_t ownerBufferSize
mip_cc_protection_type * protectionType
const int64_t userRolesCount
const int64_t const char * name
Defines success/error result codes.
mip_cc_result
API success/failure result.
Definition result_cc.h:44
Contains C API definitions for common string list.
Error information.
Definition error_cc.h:79
Opaque handle to MIP object.
A group of users and the rights associated with them.
const char ** users
List of users.
int64_t rightsCount
Number of rights.
int64_t usersCount
Number of users.
const char ** rights
List of rights.
A group of users and the roles associated with them.
int64_t rolesCount
Number of roles.
const char ** users
List of users.
const char ** roles
List of roles.
int64_t usersCount
Number of users.