MSMutableCustomProtectedData customProtectorWithProtectionPolicy:backingData:protectedContentOffset:completionBlock method

Asynchronously creates an MSMutableCustomProtectedData object that can be used to protect plaintext data and write to the specified backing NSMutableData object.

[!Important]
Rights Management SDK 4.2 based applications that use MSMutableCustomProtectedData may be incompatible with SharePoint, Exchange, and other RMS-enabled applications. For most applications, it is recommended that you use MSMutableProtectedData instead.

Signature

+ (void)customProtectorWithProtectionPolicy:(MSUserPolicy *)userPolicy
                                backingData:(NSMutableData *)backingData
                     protectedContentOffset:(NSUInteger)protectedContentOffset
                            completionBlock:(void(^)(MSMutableCustomProtectedData *customProtectedData,
                                                     NSError *error))completionBlock;

Parameters

Name Datatype Notes
userPolicy
[MSUserPolicy](msuserpolicy-interface-objc.md) *
Required.
backingData
NSMutableData *
Required. The backing NSMutableData object that will be filled with the protected content.
protectedContentOffset
NSUInteger
Required. Specifies the position in the backingData at which the protected content should start.
completionBlock
void(^)([MSMutableCustomProtectedData](msmutablecustomprotecteddata-interface-objc.md) *customProtectedData, NSError *error)
Required. Called with the following parameters when the method is completed:
customProtecedData protected data object, or NIL if the method fails.
error If there is an error protecting the data object, error points to an NSError object that describes the problem.
[!Note]
If the user cancels the operation, both the customProtectedData and error parameters will be NIL.

Defined in

MSMutableCustomProtectedData.h

Supported Platforms

Minimum supported OS versions
iOS 7.0 and OS X 10.8

Remarks

If there is no existing content in the backing data (for example, this is a new file), you should specify 0 for the encryptedContentSize.

When publishing content, apps are required to call -[MSMutableCustomProtectedData close] when they are done writing content to the MSMutableCustomProtectedData object. If close is not called the framework cannot guarantee that all the encrypted data is stored to the backing stream.

See also

MSMutableCustomProtectedData