This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
/
service.py
1532 lines (1357 loc) · 71 KB
/
service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
#
import proto # type: ignore
from google.cloud.kms_v1.types import resources
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.kms.v1",
manifest={
"ListKeyRingsRequest",
"ListCryptoKeysRequest",
"ListCryptoKeyVersionsRequest",
"ListImportJobsRequest",
"ListKeyRingsResponse",
"ListCryptoKeysResponse",
"ListCryptoKeyVersionsResponse",
"ListImportJobsResponse",
"GetKeyRingRequest",
"GetCryptoKeyRequest",
"GetCryptoKeyVersionRequest",
"GetPublicKeyRequest",
"GetImportJobRequest",
"CreateKeyRingRequest",
"CreateCryptoKeyRequest",
"CreateCryptoKeyVersionRequest",
"ImportCryptoKeyVersionRequest",
"CreateImportJobRequest",
"UpdateCryptoKeyRequest",
"UpdateCryptoKeyVersionRequest",
"UpdateCryptoKeyPrimaryVersionRequest",
"DestroyCryptoKeyVersionRequest",
"RestoreCryptoKeyVersionRequest",
"EncryptRequest",
"DecryptRequest",
"AsymmetricSignRequest",
"AsymmetricDecryptRequest",
"MacSignRequest",
"MacVerifyRequest",
"GenerateRandomBytesRequest",
"EncryptResponse",
"DecryptResponse",
"AsymmetricSignResponse",
"AsymmetricDecryptResponse",
"MacSignResponse",
"MacVerifyResponse",
"GenerateRandomBytesResponse",
"Digest",
"LocationMetadata",
},
)
class ListKeyRingsRequest(proto.Message):
r"""Request message for
[KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
Attributes:
parent (str):
Required. The resource name of the location associated with
the [KeyRings][google.cloud.kms.v1.KeyRing], in the format
``projects/*/locations/*``.
page_size (int):
Optional. Optional limit on the number of
[KeyRings][google.cloud.kms.v1.KeyRing] to include in the
response. Further [KeyRings][google.cloud.kms.v1.KeyRing]
can subsequently be obtained by including the
[ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
in a subsequent request. If unspecified, the server will
pick an appropriate default.
page_token (str):
Optional. Optional pagination token, returned earlier via
[ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
filter (str):
Optional. Only include resources that match the filter in
the response. For more information, see `Sorting and
filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
order_by (str):
Optional. Specify how the results should be sorted. If not
specified, the results will be sorted in the default order.
For more information, see `Sorting and filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
filter = proto.Field(proto.STRING, number=4,)
order_by = proto.Field(proto.STRING, number=5,)
class ListCryptoKeysRequest(proto.Message):
r"""Request message for
[KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
Attributes:
parent (str):
Required. The resource name of the
[KeyRing][google.cloud.kms.v1.KeyRing] to list, in the
format ``projects/*/locations/*/keyRings/*``.
page_size (int):
Optional. Optional limit on the number of
[CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in
the response. Further
[CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently
be obtained by including the
[ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
in a subsequent request. If unspecified, the server will
pick an appropriate default.
page_token (str):
Optional. Optional pagination token, returned earlier via
[ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
version_view (google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionView):
The fields of the primary version to include
in the response.
filter (str):
Optional. Only include resources that match the filter in
the response. For more information, see `Sorting and
filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
order_by (str):
Optional. Specify how the results should be sorted. If not
specified, the results will be sorted in the default order.
For more information, see `Sorting and filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
version_view = proto.Field(
proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView,
)
filter = proto.Field(proto.STRING, number=5,)
order_by = proto.Field(proto.STRING, number=6,)
class ListCryptoKeyVersionsRequest(proto.Message):
r"""Request message for
[KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
Attributes:
parent (str):
Required. The resource name of the
[CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the
format ``projects/*/locations/*/keyRings/*/cryptoKeys/*``.
page_size (int):
Optional. Optional limit on the number of
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
include in the response. Further
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
can subsequently be obtained by including the
[ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
in a subsequent request. If unspecified, the server will
pick an appropriate default.
page_token (str):
Optional. Optional pagination token, returned earlier via
[ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
view (google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionView):
The fields to include in the response.
filter (str):
Optional. Only include resources that match the filter in
the response. For more information, see `Sorting and
filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
order_by (str):
Optional. Specify how the results should be sorted. If not
specified, the results will be sorted in the default order.
For more information, see `Sorting and filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
view = proto.Field(
proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView,
)
filter = proto.Field(proto.STRING, number=5,)
order_by = proto.Field(proto.STRING, number=6,)
class ListImportJobsRequest(proto.Message):
r"""Request message for
[KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
Attributes:
parent (str):
Required. The resource name of the
[KeyRing][google.cloud.kms.v1.KeyRing] to list, in the
format ``projects/*/locations/*/keyRings/*``.
page_size (int):
Optional. Optional limit on the number of
[ImportJobs][google.cloud.kms.v1.ImportJob] to include in
the response. Further
[ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently
be obtained by including the
[ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
in a subsequent request. If unspecified, the server will
pick an appropriate default.
page_token (str):
Optional. Optional pagination token, returned earlier via
[ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
filter (str):
Optional. Only include resources that match the filter in
the response. For more information, see `Sorting and
filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
order_by (str):
Optional. Specify how the results should be sorted. If not
specified, the results will be sorted in the default order.
For more information, see `Sorting and filtering list
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
filter = proto.Field(proto.STRING, number=4,)
order_by = proto.Field(proto.STRING, number=5,)
class ListKeyRingsResponse(proto.Message):
r"""Response message for
[KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
Attributes:
key_rings (Sequence[google.cloud.kms_v1.types.KeyRing]):
The list of [KeyRings][google.cloud.kms.v1.KeyRing].
next_page_token (str):
A token to retrieve next page of results. Pass this value in
[ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
to retrieve the next page of results.
total_size (int):
The total number of [KeyRings][google.cloud.kms.v1.KeyRing]
that matched the query.
"""
@property
def raw_page(self):
return self
key_rings = proto.RepeatedField(proto.MESSAGE, number=1, message=resources.KeyRing,)
next_page_token = proto.Field(proto.STRING, number=2,)
total_size = proto.Field(proto.INT32, number=3,)
class ListCryptoKeysResponse(proto.Message):
r"""Response message for
[KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
Attributes:
crypto_keys (Sequence[google.cloud.kms_v1.types.CryptoKey]):
The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
next_page_token (str):
A token to retrieve next page of results. Pass this value in
[ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
to retrieve the next page of results.
total_size (int):
The total number of
[CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the
query.
"""
@property
def raw_page(self):
return self
crypto_keys = proto.RepeatedField(
proto.MESSAGE, number=1, message=resources.CryptoKey,
)
next_page_token = proto.Field(proto.STRING, number=2,)
total_size = proto.Field(proto.INT32, number=3,)
class ListCryptoKeyVersionsResponse(proto.Message):
r"""Response message for
[KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
Attributes:
crypto_key_versions (Sequence[google.cloud.kms_v1.types.CryptoKeyVersion]):
The list of
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
next_page_token (str):
A token to retrieve next page of results. Pass this value in
[ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
to retrieve the next page of results.
total_size (int):
The total number of
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
that matched the query.
"""
@property
def raw_page(self):
return self
crypto_key_versions = proto.RepeatedField(
proto.MESSAGE, number=1, message=resources.CryptoKeyVersion,
)
next_page_token = proto.Field(proto.STRING, number=2,)
total_size = proto.Field(proto.INT32, number=3,)
class ListImportJobsResponse(proto.Message):
r"""Response message for
[KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
Attributes:
import_jobs (Sequence[google.cloud.kms_v1.types.ImportJob]):
The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
next_page_token (str):
A token to retrieve next page of results. Pass this value in
[ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
to retrieve the next page of results.
total_size (int):
The total number of
[ImportJobs][google.cloud.kms.v1.ImportJob] that matched the
query.
"""
@property
def raw_page(self):
return self
import_jobs = proto.RepeatedField(
proto.MESSAGE, number=1, message=resources.ImportJob,
)
next_page_token = proto.Field(proto.STRING, number=2,)
total_size = proto.Field(proto.INT32, number=3,)
class GetKeyRingRequest(proto.Message):
r"""Request message for
[KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
Attributes:
name (str):
Required. The [name][google.cloud.kms.v1.KeyRing.name] of
the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
"""
name = proto.Field(proto.STRING, number=1,)
class GetCryptoKeyRequest(proto.Message):
r"""Request message for
[KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
Attributes:
name (str):
Required. The [name][google.cloud.kms.v1.CryptoKey.name] of
the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
"""
name = proto.Field(proto.STRING, number=1,)
class GetCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
Attributes:
name (str):
Required. The
[name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
get.
"""
name = proto.Field(proto.STRING, number=1,)
class GetPublicKeyRequest(proto.Message):
r"""Request message for
[KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
Attributes:
name (str):
Required. The
[name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
public key to get.
"""
name = proto.Field(proto.STRING, number=1,)
class GetImportJobRequest(proto.Message):
r"""Request message for
[KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
Attributes:
name (str):
Required. The [name][google.cloud.kms.v1.ImportJob.name] of
the [ImportJob][google.cloud.kms.v1.ImportJob] to get.
"""
name = proto.Field(proto.STRING, number=1,)
class CreateKeyRingRequest(proto.Message):
r"""Request message for
[KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
Attributes:
parent (str):
Required. The resource name of the location associated with
the [KeyRings][google.cloud.kms.v1.KeyRing], in the format
``projects/*/locations/*``.
key_ring_id (str):
Required. It must be unique within a location and match the
regular expression ``[a-zA-Z0-9_-]{1,63}``
key_ring (google.cloud.kms_v1.types.KeyRing):
Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with
initial field values.
"""
parent = proto.Field(proto.STRING, number=1,)
key_ring_id = proto.Field(proto.STRING, number=2,)
key_ring = proto.Field(proto.MESSAGE, number=3, message=resources.KeyRing,)
class CreateCryptoKeyRequest(proto.Message):
r"""Request message for
[KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
Attributes:
parent (str):
Required. The [name][google.cloud.kms.v1.KeyRing.name] of
the KeyRing associated with the
[CryptoKeys][google.cloud.kms.v1.CryptoKey].
crypto_key_id (str):
Required. It must be unique within a KeyRing and match the
regular expression ``[a-zA-Z0-9_-]{1,63}``
crypto_key (google.cloud.kms_v1.types.CryptoKey):
Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with
initial field values.
skip_initial_version_creation (bool):
If set to true, the request will create a
[CryptoKey][google.cloud.kms.v1.CryptoKey] without any
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
You must manually call
[CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
or
[ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
before you can use this
[CryptoKey][google.cloud.kms.v1.CryptoKey].
"""
parent = proto.Field(proto.STRING, number=1,)
crypto_key_id = proto.Field(proto.STRING, number=2,)
crypto_key = proto.Field(proto.MESSAGE, number=3, message=resources.CryptoKey,)
skip_initial_version_creation = proto.Field(proto.BOOL, number=5,)
class CreateCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
Attributes:
parent (str):
Required. The [name][google.cloud.kms.v1.CryptoKey.name] of
the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated
with the
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
crypto_key_version (google.cloud.kms_v1.types.CryptoKeyVersion):
Required. A
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
with initial field values.
"""
parent = proto.Field(proto.STRING, number=1,)
crypto_key_version = proto.Field(
proto.MESSAGE, number=2, message=resources.CryptoKeyVersion,
)
class ImportCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
Attributes:
parent (str):
Required. The [name][google.cloud.kms.v1.CryptoKey.name] of
the [CryptoKey][google.cloud.kms.v1.CryptoKey] to be
imported into.
The create permission is only required on this key when
creating a new
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
crypto_key_version (str):
Optional. The optional
[name][google.cloud.kms.v1.CryptoKeyVersion.name] of an
existing
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
target for an import operation. If this field is not
present, a new
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
containing the supplied key material is created.
If this field is present, the supplied key material is
imported into the existing
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
import into an existing
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
must be a child of
[ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
have been previously created via [ImportCryptoKeyVersion][],
and be in
[DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
or
[IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
state. The key material and algorithm must match the
previous
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
exactly if the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has
ever contained key material.
algorithm (google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionAlgorithm):
Required. The
[algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
of the key being imported. This does not need to match the
[version_template][google.cloud.kms.v1.CryptoKey.version_template]
of the [CryptoKey][google.cloud.kms.v1.CryptoKey] this
version imports into.
import_job (str):
Required. The [name][google.cloud.kms.v1.ImportJob.name] of
the [ImportJob][google.cloud.kms.v1.ImportJob] that was used
to wrap this key material.
rsa_aes_wrapped_key (bytes):
Wrapped key material produced with
[RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
or
[RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256].
This field contains the concatenation of two wrapped keys:
.. raw:: html
<ol>
<li>An ephemeral AES-256 wrapping key wrapped with the
[public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP with SHA-1,
MGF1 with SHA-1, and an empty label.
</li>
<li>The key to be imported, wrapped with the ephemeral AES-256 key
using AES-KWP (RFC 5649).
</li>
</ol>
If importing symmetric key material, it is expected that the
unwrapped key contains plain bytes. If importing asymmetric
key material, it is expected that the unwrapped key is in
PKCS#8-encoded DER format (the PrivateKeyInfo structure from
RFC 5208).
This format is the same as the format produced by PKCS#11
mechanism CKM_RSA_AES_KEY_WRAP.
"""
parent = proto.Field(proto.STRING, number=1,)
crypto_key_version = proto.Field(proto.STRING, number=6,)
algorithm = proto.Field(
proto.ENUM, number=2, enum=resources.CryptoKeyVersion.CryptoKeyVersionAlgorithm,
)
import_job = proto.Field(proto.STRING, number=4,)
rsa_aes_wrapped_key = proto.Field(
proto.BYTES, number=5, oneof="wrapped_key_material",
)
class CreateImportJobRequest(proto.Message):
r"""Request message for
[KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
Attributes:
parent (str):
Required. The [name][google.cloud.kms.v1.KeyRing.name] of
the [KeyRing][google.cloud.kms.v1.KeyRing] associated with
the [ImportJobs][google.cloud.kms.v1.ImportJob].
import_job_id (str):
Required. It must be unique within a KeyRing and match the
regular expression ``[a-zA-Z0-9_-]{1,63}``
import_job (google.cloud.kms_v1.types.ImportJob):
Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with
initial field values.
"""
parent = proto.Field(proto.STRING, number=1,)
import_job_id = proto.Field(proto.STRING, number=2,)
import_job = proto.Field(proto.MESSAGE, number=3, message=resources.ImportJob,)
class UpdateCryptoKeyRequest(proto.Message):
r"""Request message for
[KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
Attributes:
crypto_key (google.cloud.kms_v1.types.CryptoKey):
Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with
updated values.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. List of fields to be updated in
this request.
"""
crypto_key = proto.Field(proto.MESSAGE, number=1, message=resources.CryptoKey,)
update_mask = proto.Field(
proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,
)
class UpdateCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
Attributes:
crypto_key_version (google.cloud.kms_v1.types.CryptoKeyVersion):
Required.
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
with updated values.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. List of fields to be updated in
this request.
"""
crypto_key_version = proto.Field(
proto.MESSAGE, number=1, message=resources.CryptoKeyVersion,
)
update_mask = proto.Field(
proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,
)
class UpdateCryptoKeyPrimaryVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
Attributes:
name (str):
Required. The resource name of the
[CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
crypto_key_version_id (str):
Required. The id of the child
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use as primary.
"""
name = proto.Field(proto.STRING, number=1,)
crypto_key_version_id = proto.Field(proto.STRING, number=2,)
class DestroyCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
destroy.
"""
name = proto.Field(proto.STRING, number=1,)
class RestoreCryptoKeyVersionRequest(proto.Message):
r"""Request message for
[KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
restore.
"""
name = proto.Field(proto.STRING, number=1,)
class EncryptRequest(proto.Message):
r"""Request message for
[KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
Attributes:
name (str):
Required. The resource name of the
[CryptoKey][google.cloud.kms.v1.CryptoKey] or
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use for encryption.
If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is
specified, the server will use its [primary
version][google.cloud.kms.v1.CryptoKey.primary].
plaintext (bytes):
Required. The data to encrypt. Must be no larger than 64KiB.
The maximum size depends on the key version's
[protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]
keys, the plaintext must be no larger than 64KiB. For
[HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the
combined length of the plaintext and
additional_authenticated_data fields must be no larger than
8KiB.
additional_authenticated_data (bytes):
Optional. Optional data that, if specified, must also be
provided during decryption through
[DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
The maximum size depends on the key version's
[protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]
keys, the AAD must be no larger than 64KiB. For
[HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the
combined length of the plaintext and
additional_authenticated_data fields must be no larger than
8KiB.
plaintext_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
is equal to
[EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
and if so, 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.
additional_authenticated_data_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
is equal to
[EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
and if so, 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.
"""
name = proto.Field(proto.STRING, number=1,)
plaintext = proto.Field(proto.BYTES, number=2,)
additional_authenticated_data = proto.Field(proto.BYTES, number=3,)
plaintext_crc32c = proto.Field(
proto.MESSAGE, number=7, message=wrappers_pb2.Int64Value,
)
additional_authenticated_data_crc32c = proto.Field(
proto.MESSAGE, number=8, message=wrappers_pb2.Int64Value,
)
class DecryptRequest(proto.Message):
r"""Request message for
[KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
Attributes:
name (str):
Required. The resource name of the
[CryptoKey][google.cloud.kms.v1.CryptoKey] to use for
decryption. The server will choose the appropriate version.
ciphertext (bytes):
Required. The encrypted data originally returned in
[EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
additional_authenticated_data (bytes):
Optional. Optional data that must match the data originally
supplied in
[EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
ciphertext_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
is equal to
[DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
and if so, 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.
additional_authenticated_data_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
is equal to
[DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
and if so, 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.
"""
name = proto.Field(proto.STRING, number=1,)
ciphertext = proto.Field(proto.BYTES, number=2,)
additional_authenticated_data = proto.Field(proto.BYTES, number=3,)
ciphertext_crc32c = proto.Field(
proto.MESSAGE, number=5, message=wrappers_pb2.Int64Value,
)
additional_authenticated_data_crc32c = proto.Field(
proto.MESSAGE, number=6, message=wrappers_pb2.Int64Value,
)
class AsymmetricSignRequest(proto.Message):
r"""Request message for
[KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use for signing.
digest (google.cloud.kms_v1.types.Digest):
Required. The digest of the data to sign. The digest must be
produced with the same digest algorithm as specified by the
key version's
[algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
digest_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
is equal to
[AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
and if so, 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.
"""
name = proto.Field(proto.STRING, number=1,)
digest = proto.Field(proto.MESSAGE, number=3, message="Digest",)
digest_crc32c = proto.Field(
proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value,
)
class AsymmetricDecryptRequest(proto.Message):
r"""Request message for
[KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use for decryption.
ciphertext (bytes):
Required. The data encrypted with the named
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s
public key using OAEP.
ciphertext_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
is equal to
[AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
and if so, 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.
"""
name = proto.Field(proto.STRING, number=1,)
ciphertext = proto.Field(proto.BYTES, number=3,)
ciphertext_crc32c = proto.Field(
proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value,
)
class MacSignRequest(proto.Message):
r"""Request message for
[KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use for signing.
data (bytes):
Required. The data to sign. The MAC tag is
computed over this data field based on the
specific algorithm.
data_crc32c (google.protobuf.wrappers_pb2.Int64Value):
Optional. An optional CRC32C checksum of the
[MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data].
If specified,
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will verify the integrity of the received
[MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]
using this checksum.
[KeyManagementService][google.cloud.kms.v1.KeyManagementService]
will report an error if the checksum verification fails. If
you receive a checksum error, your client should verify that
CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data])
is equal to
[MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
and if so, 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.
"""
name = proto.Field(proto.STRING, number=1,)
data = proto.Field(proto.BYTES, number=2,)
data_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,)
class MacVerifyRequest(proto.Message):
r"""Request message for
[KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
Attributes:
name (str):
Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
use for verification.
data (bytes):
Required. The data used previously as a