Send feedback
Method: locations.generateRandomBytes
Stay organized with collections
Save and categorize content based on your preferences.
Full name : projects.locations.generateRandomBytes
Generate random bytes using the Cloud KMS randomness source in the provided location.
HTTP request
Choose a location:
global europe-west3 europe-west8 europe-west9 me-central2 us-east1 us-east4 us-west2 us-west1 us-east7 us-central1 us-west3 us-central2 us-west4 us-west8 us-east5 us-south1
The URLs use gRPC Transcoding syntax.
Path parameters
Parameters
location
string
The project-specific location in which to generate random bytes. For example, "projects/my-project/locations/us-central1".
Request body
The request body contains data with the following structure:
JSON representation
{
"lengthBytes" : integer ,
"protectionLevel" : enum (ProtectionLevel
)
}
Fields
lengthBytes
integer
The length in bytes of the amount of randomness to retrieve. Minimum 8 bytes, maximum 1024 bytes.
protectionLevel
enum (ProtectionLevel
)
The ProtectionLevel
to use when generating the random data. Currently, only HSM
protection level is supported.
Response body
Response message for KeyManagementService.GenerateRandomBytes
.
If successful, the response body contains data with the following structure:
JSON representation
{
"data" : string ,
"dataCrc32c" : string
}
Fields
data
string (bytes format)
The generated data.
A base64-encoded string.
dataCrc32c
string (Int64Value format)
Integrity verification field. A CRC32C checksum of the returned GenerateRandomBytesResponse.data
. An integrity check of GenerateRandomBytesResponse.data
can be performed by computing the CRC32C checksum of GenerateRandomBytesResponse.data
and comparing your results to this field. Discard the response in case of non-matching checksum values, and perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloudkms
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview .
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-24 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-09-24 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-24 UTC."]]