/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the kms-2014-11-01.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.KeyManagementService.Model
{
///
/// Container for the parameters to the GenerateRandom operation.
/// Returns a random byte string that is cryptographically secure.
///
///
///
/// You must use the NumberOfBytes
parameter to specify the length of the
/// random byte string. There is no default value for string length.
///
///
///
/// By default, the random byte string is generated in KMS. To generate the byte string
/// in the CloudHSM cluster associated with an CloudHSM key store, use the CustomKeyStoreId
/// parameter.
///
///
///
/// GenerateRandom
also supports Amazon
/// Web Services Nitro Enclaves, which provide an isolated compute environment in
/// Amazon EC2. To call GenerateRandom
for a Nitro enclave, use the Amazon
/// Web Services Nitro Enclaves SDK or any Amazon Web Services SDK. Use the Recipient
/// parameter to provide the attestation document for the enclave. Instead of plaintext
/// bytes, the response includes the plaintext bytes encrypted under the public key from
/// the attestation document (CiphertextForRecipient
).For information about
/// the interaction between KMS and Amazon Web Services Nitro Enclaves, see How
/// Amazon Web Services Nitro Enclaves uses KMS in the Key Management Service Developer
/// Guide.
///
///
///
/// For more information about entropy and random number generation, see Key
/// Management Service Cryptographic Details.
///
///
///
/// Cross-account use: Not applicable. GenerateRandom
does not use
/// any account-specific resources, such as KMS keys.
///
///
///
/// Required permissions: kms:GenerateRandom
/// (IAM policy)
///
///
public partial class GenerateRandomRequest : AmazonKeyManagementServiceRequest
{
private string _customKeyStoreId;
private int? _numberOfBytes;
private RecipientInfo _recipient;
///
/// Gets and sets the property CustomKeyStoreId.
///
/// Generates the random byte string in the CloudHSM cluster that is associated with the
/// specified CloudHSM key store. To find the ID of a custom key store, use the DescribeCustomKeyStores
/// operation.
///
///
///
/// External key store IDs are not valid for this parameter. If you specify the ID of
/// an external key store, GenerateRandom
throws an UnsupportedOperationException
.
///
///
[AWSProperty(Min=1, Max=64)]
public string CustomKeyStoreId
{
get { return this._customKeyStoreId; }
set { this._customKeyStoreId = value; }
}
// Check to see if CustomKeyStoreId property is set
internal bool IsSetCustomKeyStoreId()
{
return this._customKeyStoreId != null;
}
///
/// Gets and sets the property NumberOfBytes.
///
/// The length of the random byte string. This parameter is required.
///
///
[AWSProperty(Min=1, Max=1024)]
public int NumberOfBytes
{
get { return this._numberOfBytes.GetValueOrDefault(); }
set { this._numberOfBytes = value; }
}
// Check to see if NumberOfBytes property is set
internal bool IsSetNumberOfBytes()
{
return this._numberOfBytes.HasValue;
}
///
/// Gets and sets the property Recipient.
///
/// A signed attestation
/// document from an Amazon Web Services Nitro enclave and the encryption algorithm
/// to use with the enclave's public key. The only valid encryption algorithm is RSAES_OAEP_SHA_256
.
///
///
///
///
/// This parameter only supports attestation documents for Amazon Web Services Nitro Enclaves.
/// To include this parameter, use the Amazon
/// Web Services Nitro Enclaves SDK or any Amazon Web Services SDK.
///
///
///
/// When you use this parameter, instead of returning plaintext bytes, KMS encrypts the
/// plaintext bytes under the public key in the attestation document, and returns the
/// resulting ciphertext in the CiphertextForRecipient
field in the response.
/// This ciphertext can be decrypted only with the private key in the enclave. The Plaintext
/// field in the response is null or empty.
///
///
///
/// For information about the interaction between KMS and Amazon Web Services Nitro Enclaves,
/// see How
/// Amazon Web Services Nitro Enclaves uses KMS in the Key Management Service Developer
/// Guide.
///
///
public RecipientInfo Recipient
{
get { return this._recipient; }
set { this._recipient = value; }
}
// Check to see if Recipient property is set
internal bool IsSetRecipient()
{
return this._recipient != null;
}
}
}