IAppxEncryptionFactory5::CreateEncryptedPackageReader2 method (appxpackaging.h)

Important

Some information relates to a prerelease product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Creates a new instance of IAppxPackageReader for reading encrypted packages, with an optional parameter for specifying the expected digest for the package.

Syntax

HRESULT CreateEncryptedPackageReader2(
  IStream             *inputStream,
  const APPX_KEY_INFO *keyInfo,
  LPCWSTR             expectedDigest,
  IAppxPackageReader  **packageReader
);

Parameters

inputStream

A stream for reading the encrypted package.

keyInfo

Key info containing the base encryption key and key ID for decrypting the package. The base key is used to derive the per file encryption keys. If this parameter is null, the global test key and key ID are used.

expectedDigest

An LPCWSTR containing the expected digest, a hashed representation of the package file.

packageReader

The created package reader.

Return value

If the method succeeds, it returns S_OK. Otherwise, it returns an error code that includes, but is not limited to, those in the following table.

Return code Description
APPX_E_DIGEST_MISMATCH The digest for the object doesn't match the digest provided in expectedDigest.

Remarks

Get the digest string for the expecteDigest parameter by calling IAppxDigestProvider::GetDigest.

Requirements

Requirement Value
Header appxpackaging.h