Create Method (ConnectPackageCreationParameters, IList(HealthRecordItem))

HealthVault
Represents a package of user data that is created by HealthVault in order to be retrieved by a user using the HealthVault Shell.

Namespace: Microsoft.Health.Package
Assembly: Microsoft.Health (in Microsoft.Health.dll) Version: 2.1.0.0 (1.15.1003.9505)

public static string Create(
	ConnectPackageCreationParameters creationParameters,
	IList<HealthRecordItem> packageContents
)

Parameters

creationParameters
Type: Microsoft.Health.Package..::..ConnectPackageCreationParameters
The ConnectPackageCreationParameters to be used while creating the connect package.
packageContents
Type: System.Collections.Generic..::..IList<(Of <(<'HealthRecordItem>)>)>
The list of HealthRecordItems that will be encrypted and added to the package that the user will claim via HealthVault Shell.

Return Value

A token that the application must give to the patient to use when validating the connection request.

Package encryption is delegated to the .NET Crypto classes. The encryption algorithm supported by default is AES256. If TripleDES is required, the caller should create the custom Password Protected Package and call Create(OfflineWebApplicationConnection, String, String, String, PasswordProtectedPackage).

The answer key provided is not the actual key to the decryption. A key is derived using the answer, the salt, and the number of hash iterations (via the Rfc2898DeriveBytes class). To ensure case-insensitivity, the answer is lower cased using ToLowerInvariant()()()() (culturally-agnostic) prior to generating the derived key.

The algorithm used has the following parameters:
  • Mode = CipherMode.CBC
  • Padding = PaddingMode.ISO10126


The salt supplied is used as the salt to the derived key as well as the key to the supplied HMAC. The data must be appended to the hash, then encrypted and then Base64 encoded.

ExceptionCondition
System..::..NotSupportedException One of the items in packageContents is signed and contains streamed blobs. This is not supported.
Microsoft.Health..::..HealthServiceException If an error occurs when contacting HealthVault.
Show: