as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

HmacContext

Represents an HMAC (Hash-based Message Authentication Code) context. This class provides functionality for creating and verifying HMAC signatures.

Extends

  • BaseCryptoClass

Methods

sign()

sign(message): Promise<ArrayBuffer>

Sign a message using the HMAC context.

Parameters

message

ArrayBuffer

The message to be signed.

Returns

Promise<ArrayBuffer>

A promise that resolves to the HMAC signature as an ArrayBuffer.

Throws

AccessDeniedError If the key lacks the KeyPurpose.SIGN purpose.


verify()

verify(message, tag): Promise<boolean>

Verify the authenticity of a message using the HMAC context.

Parameters

message

ArrayBuffer

The original message to verify.

tag

ArrayBuffer

The HMAC tag (signature) to verify against the message.

Returns

Promise<boolean>

A promise that resolves to true if the message is authentic, false otherwise.

Throws

AccessDeniedError If the key lacks the KeyPurpose.VERIFY purpose.


Last updated: Sep 30, 2025