CreateConnectPackage Method (ConnectPackageCreationParameters, PasswordProtectedPackage)

Asks HealthVault to create a pending package for the application specified by the connection with the specified user specific parameters and the pre-allocated identity code.

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

public static string CreateConnectPackage(
	ConnectPackageCreationParameters creationParameters,
	PasswordProtectedPackage connectPackage


Type: Microsoft.Health.Package..::..ConnectPackageCreationParameters
The parameters to use when creating the package.
Type: Microsoft.Health.ItemTypes..::..PasswordProtectedPackage
The pending connect package that the user will add to his/her record. This package's HealthRecordItem's BlobStore must be an encrypted blob of xml that represents a list of HealthRecordItems. This xml blob must be a sequence of elements, each wrapping the XML representation of a single HealthRecordItem. Each element may be generated by calling GetItemXml()()()().

Return Value

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

The password protected package supports 2 encryption algorithms, AES256 (recommended) and TripleDES.

For AES256, the supported key size is 256 bits, the blocksize is 256 bits, the IV length is 32 bytes.

For TripleDES, the supported key size is 192 bits, the blocksize is 64 bits, the IV length is 8 bytes.

The encryption key should be derived using the answer, the salt, and the number of hash iterations. The decryption will generate this key via the Rfc2898DeriveBytes class, hence, encryption should use a similar or identical process. To ensure case-insensitivity, the answer should be converted to its lower cased form 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 salt should be at least 8 bytes long.

It is recommended that the number of hash iterations be at least 10000.

Microsoft.Health..::..HealthServiceException If an error occurs when contacting HealthVault.