IsSignatureValid Method

Checks if the health record item's signature is valid.

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

public bool IsSignatureValid()

Return Value

true if the signature is valid against the XML representation of the item returned from the service, or for new items, if the signature is valid against the XML of the item at the time the item was signed. Returns false if the signature could not be validated.

Verifies that the signature on the item is valid for the XML representation of the item as retrieved from the HealthVault service.

This method will always verify against the underlying XML of this item as returned from the service, even if local modifications are made to the item. In the case of new items that have not yet been created in the HealthVault service, this method validates the signature against the XML of the item at the time of signing.

For more information about XML digital signatures see: System.Security.Cryptography.Xml.

System..::..InvalidOperationException The signature could not be validated because the HealthRecordItem is not signed.
Microsoft.Health..::..SignatureFailureException Signature validation failed becaue either the HealthRecordItemSignatureMethod of this item is unknown and cannot be validated, or the integrity of the signature could not be verified in which case the inner exception contains details on the reasons why. The inner exception is CryptographicException, thrown because of one of: The SignatureAlgorithm property of the public key in the signature does not match the SignatureMethod property. The signature description could not be created. The hash algorithm could not be created.