Sign and verify with a common shared HMAC key

Use if the sender of the XML document and the receiver share a common secret key.

How to sign

  1. Create a HMAC key with the constructor of the CryptoKey class.
  2. Set or load the common shared key value in the CryptoKey object.
  3. Create a blank signature with the constructor of the Signature class.
  4. Assign the CryptoKey object to the Signature object.
  5. Create one or more references to be signed.
  6. Compute the signature.
  7. Retrieve the XML signature document from the Signature object.

How to verify

  1. Create a HMAC key with the constructor of the CryptoKey.
  2. Set or load the common shared key value in the CryptoKey object.
  3. Create a signature with the constructor of the Signature class and from a XML signature node obtained after the above compute operation.
  4. Assign the CryptoKey object to the Signature object.
  5. Verify the signature validity.