public sealed class GenerateRandomBytesRequest : IMessage<GenerateRandomBytesRequest>, IEquatable<GenerateRandomBytesRequest>, IDeepCloneable<GenerateRandomBytesRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Key Management Service v1 API class GenerateRandomBytesRequest.
Request message for
[KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
public ProtectionLevel ProtectionLevel { get; set; }
The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
generating the random data. Currently, only
[HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
supported.
[[["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 2025-09-04 UTC."],[[["\u003cp\u003eThe latest version available for \u003ccode\u003eGenerateRandomBytesRequest\u003c/code\u003e is 3.16.0, as part of the Google Cloud Key Management Service v1 API.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation provides reference information for the \u003ccode\u003eGenerateRandomBytesRequest\u003c/code\u003e class, which is used to request the generation of random bytes.\u003c/p\u003e\n"],["\u003cp\u003eThe class implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of the \u003ccode\u003eGenerateRandomBytesRequest\u003c/code\u003e class include \u003ccode\u003eLengthBytes\u003c/code\u003e, \u003ccode\u003eLocation\u003c/code\u003e, and \u003ccode\u003eProtectionLevel\u003c/code\u003e, which define the size, location, and security of the requested random data.\u003c/p\u003e\n"],["\u003cp\u003eThere are 25 different versions available, spanning between 2.2.0 and 3.16.0, all being covered by the documentation, so users can access the version that corresponds to their need.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Key Management Service v1 API - Class GenerateRandomBytesRequest (3.18.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.18.0 (latest)](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.17.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.17.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.16.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.16.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.15.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.15.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.14.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.13.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.12.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.11.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.10.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.9.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.8.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.7.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.6.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.5.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.4.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.3.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.2.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.1.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.0.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.9.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.8.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.7.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.6.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.5.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.4.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.3.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.2.0/Google.Cloud.Kms.V1.GenerateRandomBytesRequest) \n\n public sealed class GenerateRandomBytesRequest : IMessage\u003cGenerateRandomBytesRequest\u003e, IEquatable\u003cGenerateRandomBytesRequest\u003e, IDeepCloneable\u003cGenerateRandomBytesRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Key Management Service v1 API class GenerateRandomBytesRequest.\n\nRequest message for\n\\[KeyManagementService.GenerateRandomBytes\\]\\[google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes\\]. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e GenerateRandomBytesRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[GenerateRandomBytesRequest](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.GenerateRandomBytesRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[GenerateRandomBytesRequest](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.GenerateRandomBytesRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[GenerateRandomBytesRequest](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.GenerateRandomBytesRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Kms.V1](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Kms.V1.dll\n\nConstructors\n------------\n\n### GenerateRandomBytesRequest()\n\n public GenerateRandomBytesRequest()\n\n### GenerateRandomBytesRequest(GenerateRandomBytesRequest)\n\n public GenerateRandomBytesRequest(GenerateRandomBytesRequest other)\n\nProperties\n----------\n\n### LengthBytes\n\n public int LengthBytes { get; set; }\n\nThe length in bytes of the amount of randomness to retrieve. Minimum 8\nbytes, maximum 1024 bytes.\n\n### Location\n\n public string Location { get; set; }\n\nThe project-specific location in which to generate random bytes.\nFor example, \"projects/my-project/locations/us-central1\".\n\n### ProtectionLevel\n\n public ProtectionLevel ProtectionLevel { get; set; }\n\nThe \\[ProtectionLevel\\]\\[google.cloud.kms.v1.ProtectionLevel\\] to use when\ngenerating the random data. Currently, only\n\\[HSM\\]\\[google.cloud.kms.v1.ProtectionLevel.HSM\\] protection level is\nsupported."]]