Microsoft Information Protection (MIP) SDK for C: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C
Loading...
Searching...
No Matches
delegation_license_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/**
29 * @brief Defines C-Style DelegationLicense and DelegationLicenseSettings functions
30 *
31 * @file delegation_license_settings_cc.h
32 */
33
34#ifndef API_MIP_PROTECTION_DELEGATION_LICENSE_CC_H_
35#define API_MIP_PROTECTION_DELEGATION_LICENSE_CC_H_
36
42
43/**
44 * @brief Handle to a \ref DelegationLicense object
45 *
46 */
48/**
49 * @brief Handle to a DelegationLicenseSettings object
50 *
51 */
53/**
54 * @brief Handle to a collection of \ref mip_cc_delegation_license objects
55 *
56 */
58
59/**
60 * @brief Creates the settings required for generating delegation licenses and end-user licenses.
61 *
62 * @param mipContext Global context shared across all profiles
63 * @param serializedPublishingLicense Buffer containing raw publishing license
64 * @param publishingLicenseBufferSize Size of publishing license buffer
65 * @param users List of users to obtain licenses on behalf of
66 * @param acquireEndUserLicenses Set to 'true' to obtain end-user licenses that are encrypted using end-user keys
67 * @param delegationLicenseSettings [Output] Handle to the new delegation license settings object
68 * @param errorInfo [Output] (Optional) Failure info if operation result is error
69 *
70 * @return Result code indicating success or failure
71 *
72 * @note To avoid memory leaks, \p delegationLicenseSettings must be released using \ref MIP_CC_ReleaseDelegationLicenseSettings.
73 */
74MIP_CC_API(mip_cc_result) MIP_CC_CreateDelegationLicenseSettings(
82
83/**
84 * @brief Releases a \ref mip_cc_delegation_license_settings object
85 *
86 * @param licenses The \ref mip_cc_delegation_license_settings object to release
87 */
88MIP_CC_API(void) MIP_CC_ReleaseDelegationLicenseSettings(
90
91/**
92 * @brief Gets an array of delegation license objects from a mip_cc_delegation_licenses object
93 *
94 * @param licenses Handle to a collection of \ref mip_cc_delegation_license objects
95 * @param delegationLicenseArray [Input/Output] Caller allocated array of \ref mip_cc_delegation_license objects.
96 * Set this value to \c nullptr to determine the number of items in \p licenses.
97 * @param count [Input/Output] Upon input, the size of \p delegationLicenseArray <em>in items</em>.
98 * Upon output, the number of items written to \p delegationLicenseArray.
99 * Each item is \c sizeof(mip_cc_delegation_license).
100 * If \p delegationLicenseArray is \c nullptr, \c count returns the size required (in items) to store
101 * the array of mip_cc_delegation_license objects.
102 * @param errorInfo [Output] (Optional) Failure info if operation result is error
103 *
104 * @return Result code indicating success or failure
105 *
106 * @note If the input array is too small, the input is truncated and
107 * \ref MIP_RESULT_ERROR_INSUFFICIENT_BUFFER is returned. The caller is responsible for releasing
108 * each returned \ref mip_cc_delegation_license by calling \ref MIP_CC_ReleaseDelegationLicense.
109 */
110MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicenses_GetLicenses(
111 const mip_cc_delegation_licenses licenses,
113 int32_t* count,
115
116/**
117 * @brief Gets the dynamic watermark from the delegation license object
118 *
119 * @param license Handle to a \ref mip_cc_delegation_license object
120 * @param dynamicWatermark [Output] Handle to the dynamic watermark (null if not present)
121 * @param errorInfo [Output] (Optional) Failure info if operation result is error
122 *
123 * @return Result code indicating success or failure
124 *
125 * @note The returned \p dynamicWatermark (mip_cc_dynamic_watermark*) must be freed by
126 * calling \ref MIP_CC_ReleaseDynamicWatermark
127*/
128MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicense_GetDynamicWatermark (
129 const mip_cc_delegation_license license,
132
133/**
134 * @brief Releases a \ref mip_cc_delegation_licenses object
135 *
136 * @param licenses The \ref mip_cc_delegation_licenses object to release
137 */
138MIP_CC_API(void) MIP_CC_ReleaseDelegationLicenses(
140
141/**
142 * @brief Releases a \ref mip_cc_delegation_license object
143 *
144 * @param license The \ref mip_cc_delegation_license object to release
145 */
146MIP_CC_API(void) MIP_CC_ReleaseDelegationLicense(
148
149/**
150 * @brief Gets the delegation license in JSON format. For encryption operations, the delegation license
151 * uses the key that is associated with the identity that retrieved the delegation license.
152 *
153 * @param license Handle to the \ref mip_cc_delegation_license object
154 * @param serializedLicense [Input/Output] Caller allocated buffer <em>in bytes</em> for the
155 * JSON delegation license. Set this value to \c nullptr to determine the number of bytes in
156 * \p serializedLicense.
157 * @param serializedLicenseSize [Input/Output] Upon input, the size of \p serializedLicense
158 * <em>in bytes</em>. Upon output, the number of bytes written to \p serializedLicense.
159 * If \p serializedLicense is \c nullptr, \c serializedLicenseSize returns the size required
160 * (in bytes) to store the \p serializedLicense.
161 * @param errorInfo [Output] (Optional) Failure info if operation result is error
162 *
163 * @return Result code indicating success or failure
164 *
165 * @note If the input buffer is too small, the input is truncated and
166 * \ref MIP_RESULT_ERROR_INSUFFICIENT_BUFFER is returned. The input buffer is \e NOT guaranteed
167 * to be null terminated.
168 */
169MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicense_GetSerializedDelegationJsonLicense(
170 const mip_cc_delegation_license license,
174
175/**
176 * @brief Gets the delegation license in XRML format. For encryption operations, the delegation license
177 * uses the key that is associated with the identity that retrieved the delegation license.
178 *
179 * @param license Handle to the \ref mip_cc_delegation_license object
180 * @param serializedLicense [Input/Output] Caller allocated buffer <em>in bytes</em> for the
181 * XRML delegation license. Set this value to \c nullptr to determine the number of bytes in
182 * \p serializedLicense.
183 * @param serializedLicenseSize [Input/Output] Upon input, the size of \p serializedLicense
184 * <em>in bytes</em>. Upon output, the number of bytes written to \p serializedLicense.
185 * If \p serializedLicense is \c nullptr, \c serializedLicenseSize returns the size required
186 * (in bytes) to store the \p serializedLicense.
187 * @param errorInfo [Output] (Optional) Failure info if operation result is error
188 *
189 * @return Result code indicating success or failure
190 *
191 * @note If the input buffer is too small, the input is truncated and
192 * \ref MIP_RESULT_ERROR_INSUFFICIENT_BUFFER is returned. The input buffer is \e NOT guaranteed
193 * to be null terminated.
194 */
195MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicense_GetSerializedDelegationXrmlLicense(
196 const mip_cc_delegation_license license,
197 uint8_t* serializedLicense,
198 int32_t* serializedLicenseSize,
200
201/**
202 * @brief Gets the end-user license that can be accessed with the key associated with the end-user's identity.
203 *
204 * @param license Handle to the \ref mip_cc_delegation_license object
205 * @param format The \ref mip_cc_pre_license_format to use when retrieving the end-user license
206 * @param serializedLicense [Input/Output] Caller allocated buffer <em>in bytes</em> for the
207 * XRML delegation license. Set this value to \c nullptr to determine the number of bytes in
208 * \p serializedLicense.
209 * @param serializedLicenseSize [Input/Output] Upon input, the size of \p serializedLicense
210 * <em>in bytes</em>. Upon output, the number of bytes written to \p serializedLicense.
211 * If \p serializedLicense is \c nullptr, \c serializedLicenseSize returns the size required
212 * (in bytes) to store the \p serializedLicense.
213 * @param errorInfo [Output] (Optional) Failure info if operation result is error
214 *
215 * @return Result code indicating success or failure
216 *
217 * @note If the input buffer is too small, the input is truncated and
218 * \ref MIP_RESULT_ERROR_INSUFFICIENT_BUFFER is returned. The input buffer is \e NOT guaranteed
219 * to be null terminated.
220 */
221MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicense_GetSerializedUserLicense(
222 const mip_cc_delegation_license license,
224 uint8_t* serializedLicense,
225 int32_t* serializedLicenseSize,
227
228/**
229 * @brief Get the user associated with this collection of licenses
230 *
231 * @param license Handle to the \ref mip_cc_delegation_license object
232 * @param user [Output] Address of a null terminated character array that defines the user that is associated
233 * with this license collection.
234 * @param errorInfo [Output] (Optional) Failure info if operation result is error
235 *
236 * @return Result code indicating success or failure
237 *
238 * @note The memory associated with \p user is temporary and may not be accessible once other
239 * \c MIP_CC_DelegationLicense calls are executed.
240 */
241MIP_CC_API(mip_cc_result) MIP_CC_DelegationLicense_GetUser(
242 const mip_cc_delegation_license license,
243 const char** user,
245
246#endif // API_MIP_PROTECTION_DELEGATION_LICENSE_CC_H_
A file Containing the common types used by the upe, file and protection modules.
mip_cc_delegation_license * delegationLicenseArray
mip_cc_delegation_license int32_t * count
mip_cc_dynamic_watermark * dynamicWatermark
const uint8_t int32_t publishingLicenseBufferSize
MIP_CC_API(void) MIP_CC_ReleaseDelegationLicenseSettings(mip_cc_delegation_license_settings licenses)
Releases a mip_cc_delegation_license_settings object.
const mip_cc_pre_license_format format
uint8_t * serializedLicense
mip_cc_handle * mip_cc_delegation_licenses
Handle to a collection of mip_cc_delegation_license objects.
mip_cc_handle * mip_cc_delegation_license_settings
Handle to a DelegationLicenseSettings object.
mip_cc_handle * mip_cc_delegation_license
Handle to a DelegationLicense object.
uint8_t int32_t * serializedLicenseSize
const uint8_t int32_t mip_cc_string_list bool mip_cc_delegation_license_settings * delegationLicenseSettings
const char ** user
const uint8_t int32_t mip_cc_string_list bool mip_cc_delegation_license_settings mip_cc_error * errorInfo
const uint8_t int32_t mip_cc_string_list users
const uint8_t int32_t mip_cc_string_list bool acquireEndUserLicenses
const uint8_t * serializedPublishingLicense
Defines C-Style MipContext functions.
const char const mip_cc_log_level const bool const mip_cc_logger_delegate const mip_cc_telemetry_configuration mip_cc_mip_context * mipContext
Defines C-Style ProtectionHandler interface.
mip_cc_pre_license_format
Defines pre-license format.
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.