Partager via


MSProtectedData class

MSProtectedData and its mutable subclass MSMutableProtectedData provide protected file data objects, object-oriented wrappers for files that are protected using the Microsoft Protected File format. Use MSProtectedData to read (and transparently decrypt) protected files in consumption scenarios and MSMutableProtectedData to write (and transparently encrypt) data to protected files in publishing scenarios.

Signature

@interface MSProtectedData : NSSecureCodableObject

Properties

Name Description
originalFileExtension
The file extension before encryption.
userPolicy
Gets the user policy.

Methods

Name Description
protectedDataWithProtectedFile
Asynchronously creates and returns a protected file data object that can be used to read (and decrypt) data from a file protected with Microsoft Protected File format.
getBytes:length
Copies the specified number of plaintext bytes from the start of the receiver s data into a given buffer. Decryption is transparently performed during the execution of the method.
getBytes:range
Copies a range of plaintext bytes from the receiver s data into a given buffer. Decryption is transparently performed during the execution of the method.
length
Returns the number of bytes contained in the receiver.
retrieveData
Returns an NSData data object that contains a copy of all of the receiver s plaintext bytes. Decryption is transparently performed during the execution of the method.
subdataWithRange
Returns an NSData data object that contains a copy of the receiver s plaintext bytes that fall within the limits specified by a given range. Decryption is transparently performed during the execution of the method.

Defined in

MSProtectedData.h

Supported Platforms

Minimum supported OS versions
iOS 7.0 and OS X 10.8

Remarks

The methods of the MSProtectedData class that read data transparently decrypt the protected content and return plaintext data.

MSProtectedData and MSMutableProtectedData are used to read and write files that are protected with the Microsoft Protected File format. To read and write data for files that are protected with a custom protected file format, use MSCustomProtectedData and MSMutableCustomProtectedData.

Thread Safety

Members of this class are not guaranteed to be thread safe.