Generate Random
kms_generate_random | R Documentation |
Returns a random byte string that is cryptographically secure¶
Description¶
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.
generate_random
also supports Amazon Web Services Nitro
Enclaves,
which provide an isolated compute environment in Amazon EC2. To call
generate_random
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. generate_random
does not use
any account-specific resources, such as KMS keys.
Required permissions: kms:GenerateRandom (IAM policy)
Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.
Usage¶
kms_generate_random(NumberOfBytes, CustomKeyStoreId, Recipient)
Arguments¶
NumberOfBytes |
The length of the random byte string. This parameter is required. |
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 External key store IDs are not valid for this parameter. If you
specify the ID of an external key store, |
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 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
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. |
Value¶
A list with the following syntax:
list(
Plaintext = raw,
CiphertextForRecipient = raw
)
Request syntax¶
svc$generate_random(
NumberOfBytes = 123,
CustomKeyStoreId = "string",
Recipient = list(
KeyEncryptionAlgorithm = "RSAES_OAEP_SHA_256",
AttestationDocument = raw
)
)
Examples¶
## Not run:
# The following example generates 32 bytes of random data.
svc$generate_random(
NumberOfBytes = 32L
)
## End(Not run)