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.
Namespace: Amazon.KeyManagementService.Model
Assembly: AWSSDK.KeyManagementService.dll
Version: 3.x.y.z
public class GenerateMacResponse : AmazonWebServiceResponse
The GenerateMacResponse type exposes the following members
| Name | Description | |
|---|---|---|
|
GenerateMacResponse() |
| Name | Type | Description | |
|---|---|---|---|
|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
KeyId | System.String |
Gets and sets the property KeyId. The HMAC KMS key used in the operation. |
|
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. |
|
MacAlgorithm | Amazon.KeyManagementService.MacAlgorithmSpec |
Gets and sets the property MacAlgorithm. The MAC algorithm that was used to generate the HMAC. |
|
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
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.
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.
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer