IpcfEncryptFileStreamWithMetadata function

Used to encrypt a file as a byte stream and optionally add metadata to the encryption license.

Syntax

HRESULT WINAPI IpcfEncryptFileStreamWithMetadata(
  _In_     ILockBytes             *pInputFileStream,
  _In_     LPCWSTR                wszInputFilePath,
  _In_     LPCVOID                pvLicenseInfo,
  _In_     DWORD                  dwType,
  _In_     DWORD                  dwFlags,
  _In_opt_ PCIPC_PROMPT_CTX       pContext,
  _In_opt_ PCIPC_LICENSE_METADATA pLicenseMetadata,
  _Out_    ILockBytes             *pOutputFileStream,
  _Out_    LPCWSTR                *pwszOutputFilePath
);

Parameters

pInputFileStream [in]

Pointer to the byte stream representing the file to be encrypted.

wszInputFilePath [in]

Specifies a file name and file extension.

The file name and may also contain the path to the file. If a relative path is specified, the current working directory is used to create the absolute path.

pvLicenseInfo [in]

License information used for encryption.

For more information, see Encrypt file input type

dwType [in]

Type of license information used for encryption.

For a list of valid values, see Encrypt file input type

dwFlags [in]

Specify optional behavior for this API.

For a list of valid values, see Encrypt file flags

pContext [in, optional]

Optional pointer to user prompt information, PCIPC_PROMPT_CTX, for the client.

pLicenseMetadata [in, optional]

Optional pointer to metadata information, PCIPC_LICENSE_METADATA, to be added to the file protection license.

pOutputFileStream [out]

Required to get the encrypted bytes as a result of an encryption operation on a byte stream.

pwszOutputFilePath [out]

On success, this is a suggested output file name.

This should be freed using IpcFreeMemory.

If wszOutputFilePath does not change, the output parameter will be NULL.

Return value

If the function succeeds, the return value is S_OK. If the function fails, it returns an HRESULT value that indicates the error.

For more information, see Error codes for a description of all RMS SDK 2.1 return values.

Possible values include, but are not limited to, those in the following list.

IPCERROR_FILE_ENCRYPT_BLOCKED

IPCERROR_FILE_UPDATELICENSE_BLOCKED

ERROR_FILE_READ_ONLY

Requirements

Minimum supported client
Windows Vista with SP2
Minimum supported server
Windows Server 2008
Header
Ipcfile.h (include Msipc.h)
Library
Msipc.lib
DLL
Msipc.dll

See also

License metadata property types

Notification preference

Notification type

IpcCreateLicenseMetadataHandle

IpcSetLicenseMetadataProperty

IpcSerializeLicenseWithMetadata

IpcfEncryptFileWithMetadata

IpcfEncryptFileStreamWithMetadata

IpcRegisterLicense