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.
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
Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use 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)
This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginGenerateRandom and EndGenerateRandom.
public virtual Task<GenerateRandomResponse> GenerateRandomAsync( GenerateRandomRequest request, CancellationToken cancellationToken )
Container for the necessary parameters to execute the GenerateRandom service method.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
|CustomKeyStoreInvalidStateException||The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation. This exception is thrown under the following conditions: You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore). You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED. You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values. You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED. You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.|
|CustomKeyStoreNotFoundException||The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.|
|DependencyTimeoutException||The system timed out while trying to fulfill the request. You can retry the request.|
|KMSInternalException||The request was rejected because an internal exception occurred. The request can be retried.|
|UnsupportedOperationException||The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.|
.NET Core App:
Supported in: 3.1
Supported in: 2.0
Supported in: 4.5