Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
ProtectionHandler Class Referenceabstract

Manages protection-related actions for a specific protection configuration. More...

#include <src/api/mip/protection/protection_handler.h>

Classes

class  ConsumptionSettings
 Settings used to create a ProtectionHandler to consume existing content. More...
 
class  Observer
 Interface that receives notifications related to ProtectionHandler. More...
 
class  PublishingSettings
 Settings used to create a ProtectionHandler to protect new content. More...
 

Public Types

enum class  PreLicenseFormat {
  Xml ,
  Json
}
 Pre-license format. More...
 

Public Member Functions

virtual bool AccessCheck (const std::string &right) const =0
 Checks if protection handler grants user access to the specified right.
 
virtual std::shared_ptr< StreamCreateProtectedStream (const std::shared_ptr< Stream > &backingStream, int64_t contentStartPosition, int64_t contentSize)=0
 Create a protected stream that will allow for encryption/decryption of content.
 
virtual int64_t DecryptBuffer (int64_t offsetFromStart, const uint8_t *inputBuffer, int64_t inputBufferSize, uint8_t *outputBuffer, int64_t outputBufferSize, bool isFinal)=0
 Decrypt a buffer.
 
virtual bool DoesUseDeprecatedAlgorithms ()=0
 Gets if protection handler uses deprecated crypto algorithms (ECB) for backward compatibility or not.
 
virtual int64_t EncryptBuffer (int64_t offsetFromStart, const uint8_t *inputBuffer, int64_t inputBufferSize, uint8_t *outputBuffer, int64_t outputBufferSize, bool isFinal)=0
 Encrypt a buffer.
 
virtual int64_t GetBlockSize ()=0
 Gets the block size (in bytes) for the cipher mode used by this ProtectionHandler.
 
virtual CipherMode GetCipherMode () const =0
 Gets the cipher mode of the protection handler.
 
virtual const std::string GetContentId ()=0
 Gets unique identifier for the document/content.
 
virtual const std::string GetIssuedTo ()=0
 Gets user associated with the protection handler.
 
virtual const std::string GetOwner ()=0
 Gets email address of content owner.
 
virtual int64_t GetProtectedContentLength (int64_t unprotectedLength, bool includesFinalBlock)=0
 Calculates size (in bytes) of content if it were to be encrypted with this ProtectionHandler.
 
virtual std::shared_ptr< ProtectionDescriptorGetProtectionDescriptor ()=0
 Gets protection details.
 
virtual std::vector< std::string > GetRights () const =0
 Gets the rights granted to the user/identity associated with this ProtectionHandler.
 
virtual const std::vector< uint8_t > & GetSerializedPreLicense (PreLicenseFormat format) const =0
 Get pre-license.
 
virtual const std::vector< uint8_t > & GetSerializedPublishingLicense () const =0
 Serialize ProtectionHandler into a publishing license (PL)
 
virtual bool IsAuditedExtractAllowed ()=0
 Gets if protection handler grants user 'audited extract' right or not.
 
virtual bool IsIssuedToOwner ()=0
 Gets if the current user is the content owner or not.
 
virtual bool UsesApplicationDefinedPadding ()=0
 Gets if protected content requires application-defined padding or if it is handled internally.
 

Detailed Description

Manages protection-related actions for a specific protection configuration.

Definition at line 60 of file protection_handler.h.

Member Enumeration Documentation

◆ PreLicenseFormat

Pre-license format.

Enumerator
Xml 

Legacy XML/SOAP format used by MSIPC.

Json 

JSON/REST format used by MIP SDK and RMS SDK.

Definition at line 464 of file protection_handler.h.

464 {
465 Xml, /**< Legacy XML/SOAP format used by MSIPC */
466 Json, /**< JSON/REST format used by MIP SDK and RMS SDK */
467 };
@ Xml
Legacy XML/SOAP format used by MSIPC.
@ Json
JSON/REST format used by MIP SDK and RMS SDK.

Member Function Documentation

◆ AccessCheck()

virtual bool ProtectionHandler::AccessCheck ( const std::string & right) const
pure virtual

Checks if protection handler grants user access to the specified right.

Parameters
rightRight to check
Returns
If protection handler grants user access to the specified right or not

◆ CreateProtectedStream()

virtual std::shared_ptr< Stream > ProtectionHandler::CreateProtectedStream ( const std::shared_ptr< Stream > & backingStream,
int64_t contentStartPosition,
int64_t contentSize )
pure virtual

Create a protected stream that will allow for encryption/decryption of content.

Parameters
backingStreamBacking stream from which to read/write
contentStartPositionStarting position (in bytes) within the backing stream where protected content begins
contentSizeSize (in bytes) of protected content within backing stream
Returns
Protected stream

◆ DecryptBuffer()

virtual int64_t ProtectionHandler::DecryptBuffer ( int64_t offsetFromStart,
const uint8_t * inputBuffer,
int64_t inputBufferSize,
uint8_t * outputBuffer,
int64_t outputBufferSize,
bool isFinal )
pure virtual

Decrypt a buffer.

Parameters
offsetFromStartRelative position of inputBuffer from the very beginning of the encrypted content
inputBufferBuffer of encrypted content that will be decrypted
inputBufferSizeSize (in bytes) of input buffer
outputBufferBuffer into which decrypted content will be copied
outputBufferSizeSize (in bytes) of output buffer
isFinalIf input buffer contains the final encrypted bytes or not
Returns
actual size (in bytes) of decrypted content

◆ DoesUseDeprecatedAlgorithms()

virtual bool ProtectionHandler::DoesUseDeprecatedAlgorithms ( )
pure virtual

Gets if protection handler uses deprecated crypto algorithms (ECB) for backward compatibility or not.

Returns
If protection handler uses deprecated crypto algorithms or not

◆ EncryptBuffer()

virtual int64_t ProtectionHandler::EncryptBuffer ( int64_t offsetFromStart,
const uint8_t * inputBuffer,
int64_t inputBufferSize,
uint8_t * outputBuffer,
int64_t outputBufferSize,
bool isFinal )
pure virtual

Encrypt a buffer.

Parameters
offsetFromStartRelative position of inputBuffer from the very beginning of the cleartext content
inputBufferBuffer of cleartext content that will be encrypted
inputBufferSizeSize (in bytes) of input buffer
outputBufferBuffer into which encrypted content will be copied
outputBufferSizeSize (in bytes) of output buffer
isFinalIf input buffer contains the final cleartext bytes or not
Returns
actual size (in bytes) of encrypted content

◆ GetBlockSize()

virtual int64_t ProtectionHandler::GetBlockSize ( )
pure virtual

Gets the block size (in bytes) for the cipher mode used by this ProtectionHandler.

Returns
Block size (in bytes)

◆ GetCipherMode()

virtual CipherMode ProtectionHandler::GetCipherMode ( ) const
pure virtual

Gets the cipher mode of the protection handler.

Returns
The cipher mode

◆ GetContentId()

virtual const std::string ProtectionHandler::GetContentId ( )
pure virtual

Gets unique identifier for the document/content.

Returns
Unique content identifier
Note
Publishing licenses will have this identifier surrounded by curly braces "{}". Those braces are removed from the value returned here

◆ GetIssuedTo()

virtual const std::string ProtectionHandler::GetIssuedTo ( )
pure virtual

Gets user associated with the protection handler.

Returns
User associated with protection handler

◆ GetOwner()

virtual const std::string ProtectionHandler::GetOwner ( )
pure virtual

Gets email address of content owner.

Returns
Email address of content owner

◆ GetProtectedContentLength()

virtual int64_t ProtectionHandler::GetProtectedContentLength ( int64_t unprotectedLength,
bool includesFinalBlock )
pure virtual

Calculates size (in bytes) of content if it were to be encrypted with this ProtectionHandler.

Parameters
unprotectedLengthSize (in bytes) of unprotected content
includesFinalBlockDescribes if the unprotected content in question includes the final block or not. For example, in CBC4k encryption mode, non-final protected blocks are the same size as unprotected blocks, but final protected blocks are larger than their unprotected counterparts.
Returns
Size (in bytes) of protected content

◆ GetProtectionDescriptor()

virtual std::shared_ptr< ProtectionDescriptor > ProtectionHandler::GetProtectionDescriptor ( )
pure virtual

Gets protection details.

Returns
Protection details

◆ GetRights()

virtual std::vector< std::string > ProtectionHandler::GetRights ( ) const
pure virtual

Gets the rights granted to the user/identity associated with this ProtectionHandler.

Returns
Rights granted to the user

◆ GetSerializedPreLicense()

virtual const std::vector< uint8_t > & ProtectionHandler::GetSerializedPreLicense ( PreLicenseFormat format) const
pure virtual

Get pre-license.

Parameters
formatPre-license format
Returns
Serialized pre-license
Note
A pre-license allows a user to immediately consume content without making an additional HTTP call. The ProtectionHandler must have been created with a ProtectionHandler::PublishingSettings::SetPreLicenseUserEmail value or else this will return an empty vector.

◆ GetSerializedPublishingLicense()

virtual const std::vector< uint8_t > & ProtectionHandler::GetSerializedPublishingLicense ( ) const
pure virtual

Serialize ProtectionHandler into a publishing license (PL)

Returns
Serialized publishing license

◆ IsAuditedExtractAllowed()

virtual bool ProtectionHandler::IsAuditedExtractAllowed ( )
pure virtual

Gets if protection handler grants user 'audited extract' right or not.

Returns
If protection handler grants user 'audited extract' right or not

◆ IsIssuedToOwner()

virtual bool ProtectionHandler::IsIssuedToOwner ( )
pure virtual

Gets if the current user is the content owner or not.

Returns
If the current user is the content owner or not

◆ UsesApplicationDefinedPadding()

virtual bool ProtectionHandler::UsesApplicationDefinedPadding ( )
pure virtual

Gets if protected content requires application-defined padding or if it is handled internally.

Returns
True, if application-defined padding is required, false if not.

The documentation for this class was generated from the following file: