AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

This is the response object from the GenerateMac operation.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.KeyManagementService.Model.GenerateMacResponse

Namespace: Amazon.KeyManagementService.Model
Assembly: AWSSDK.KeyManagementService.dll
Version: 3.x.y.z

Syntax

C#
public class GenerateMacResponse : AmazonWebServiceResponse

The GenerateMacResponse type exposes the following members

Constructors

NameDescription
Public Method GenerateMacResponse()

Properties

NameTypeDescription
Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property KeyId System.String

Gets and sets the property KeyId.

The HMAC KMS key used in the operation.

Public Property Mac System.IO.MemoryStream

Gets and sets the property Mac.

The hash-based message authentication code (HMAC) that was generated for the specified message, HMAC KMS key, and MAC algorithm.

This is the standard, raw HMAC defined in RFC 2104.

Public Property MacAlgorithm Amazon.KeyManagementService.MacAlgorithmSpec

Gets and sets the property MacAlgorithm.

The MAC algorithm that was used to generate the HMAC.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.

Examples

This example generates an HMAC for a message, an HMAC KMS key, and a MAC algorithm. The algorithm must be supported by the specified HMAC KMS key.

To generate an HMAC for a message


var client = new AmazonKeyManagementServiceClient();
var response = client.GenerateMac(new GenerateMacRequest 
{
    KeyId = "1234abcd-12ab-34cd-56ef-1234567890ab", // The HMAC KMS key input to the HMAC algorithm.
    MacAlgorithm = "HMAC_SHA_384", // The HMAC algorithm requested for the operation.
    Message = new MemoryStream(Hello World) // The message input to the HMAC algorithm.
});

string keyId = response.KeyId; // The key ARN of the HMAC KMS key used in the operation.
MemoryStream mac = response.Mac; // The HMAC tag that results from this operation.
string macAlgorithm = response.MacAlgorithm; // The HMAC algorithm used in the operation.

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5