forked from googleapis/google-api-php-client-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCryptoKey.php
More file actions
372 lines (368 loc) · 11.6 KB
/
CryptoKey.php
File metadata and controls
372 lines (368 loc) · 11.6 KB
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
<?php
/*
* Copyright 2014 Google Inc.
*
* 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.
*/
namespace Google\Service\CloudKMS;
class CryptoKey extends \Google\Model
{
/**
* Not specified.
*/
public const PURPOSE_CRYPTO_KEY_PURPOSE_UNSPECIFIED = 'CRYPTO_KEY_PURPOSE_UNSPECIFIED';
/**
* CryptoKeys with this purpose may be used with Encrypt and Decrypt.
*/
public const PURPOSE_ENCRYPT_DECRYPT = 'ENCRYPT_DECRYPT';
/**
* CryptoKeys with this purpose may be used with AsymmetricSign and
* GetPublicKey.
*/
public const PURPOSE_ASYMMETRIC_SIGN = 'ASYMMETRIC_SIGN';
/**
* CryptoKeys with this purpose may be used with AsymmetricDecrypt and
* GetPublicKey.
*/
public const PURPOSE_ASYMMETRIC_DECRYPT = 'ASYMMETRIC_DECRYPT';
/**
* CryptoKeys with this purpose may be used with RawEncrypt and RawDecrypt.
* This purpose is meant to be used for interoperable symmetric encryption and
* does not support automatic CryptoKey rotation.
*/
public const PURPOSE_RAW_ENCRYPT_DECRYPT = 'RAW_ENCRYPT_DECRYPT';
/**
* CryptoKeys with this purpose may be used with MacSign.
*/
public const PURPOSE_MAC = 'MAC';
/**
* CryptoKeys with this purpose may be used with GetPublicKey and Decapsulate.
*/
public const PURPOSE_KEY_ENCAPSULATION = 'KEY_ENCAPSULATION';
/**
* Output only. The time at which this CryptoKey was created.
*
* @var string
*/
public $createTime;
/**
* Immutable. The resource name of the backend environment where the key
* material for all CryptoKeyVersions associated with this CryptoKey reside
* and where all related cryptographic operations are performed. Only
* applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC,
* with the resource name in the format `projects/locations/ekmConnections`.
* Only applicable if CryptoKeyVersions have a ProtectionLevel of
* HSM_SINGLE_TENANT, with the resource name in the format
* `projects/locations/singleTenantHsmInstances`. Note, this list is non-
* exhaustive and may apply to additional ProtectionLevels in the future.
*
* @var string
*/
public $cryptoKeyBackend;
/**
* Immutable. The period of time that versions of this key spend in the
* DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified
* at creation time, the default duration is 30 days.
*
* @var string
*/
public $destroyScheduledDuration;
/**
* Immutable. Whether this key may contain imported versions only.
*
* @var bool
*/
public $importOnly;
protected $keyAccessJustificationsPolicyType = KeyAccessJustificationsPolicy::class;
protected $keyAccessJustificationsPolicyDataType = '';
/**
* Labels with user-defined metadata. For more information, see [Labeling
* Keys](https://cloud.google.com/kms/docs/labeling-keys).
*
* @var string[]
*/
public $labels;
/**
* Output only. The resource name for this CryptoKey in the format
* `projects/locations/keyRings/cryptoKeys`.
*
* @var string
*/
public $name;
/**
* At next_rotation_time, the Key Management Service will automatically: 1.
* Create a new version of this CryptoKey. 2. Mark the new version as primary.
* Key rotations performed manually via CreateCryptoKeyVersion and
* UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time. Keys with
* purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this
* field must be omitted.
*
* @var string
*/
public $nextRotationTime;
protected $primaryType = CryptoKeyVersion::class;
protected $primaryDataType = '';
/**
* Immutable. The immutable purpose of this CryptoKey.
*
* @var string
*/
public $purpose;
/**
* next_rotation_time will be advanced by this period when the service
* automatically rotates a key. Must be at least 24 hours and at most 876,000
* hours. If rotation_period is set, next_rotation_time must also be set. Keys
* with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys,
* this field must be omitted.
*
* @var string
*/
public $rotationPeriod;
protected $versionTemplateType = CryptoKeyVersionTemplate::class;
protected $versionTemplateDataType = '';
/**
* Output only. The time at which this CryptoKey was created.
*
* @param string $createTime
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* Immutable. The resource name of the backend environment where the key
* material for all CryptoKeyVersions associated with this CryptoKey reside
* and where all related cryptographic operations are performed. Only
* applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC,
* with the resource name in the format `projects/locations/ekmConnections`.
* Only applicable if CryptoKeyVersions have a ProtectionLevel of
* HSM_SINGLE_TENANT, with the resource name in the format
* `projects/locations/singleTenantHsmInstances`. Note, this list is non-
* exhaustive and may apply to additional ProtectionLevels in the future.
*
* @param string $cryptoKeyBackend
*/
public function setCryptoKeyBackend($cryptoKeyBackend)
{
$this->cryptoKeyBackend = $cryptoKeyBackend;
}
/**
* @return string
*/
public function getCryptoKeyBackend()
{
return $this->cryptoKeyBackend;
}
/**
* Immutable. The period of time that versions of this key spend in the
* DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified
* at creation time, the default duration is 30 days.
*
* @param string $destroyScheduledDuration
*/
public function setDestroyScheduledDuration($destroyScheduledDuration)
{
$this->destroyScheduledDuration = $destroyScheduledDuration;
}
/**
* @return string
*/
public function getDestroyScheduledDuration()
{
return $this->destroyScheduledDuration;
}
/**
* Immutable. Whether this key may contain imported versions only.
*
* @param bool $importOnly
*/
public function setImportOnly($importOnly)
{
$this->importOnly = $importOnly;
}
/**
* @return bool
*/
public function getImportOnly()
{
return $this->importOnly;
}
/**
* Optional. The policy used for Key Access Justifications Policy Enforcement.
* If this field is present and this key is enrolled in Key Access
* Justifications Policy Enforcement, the policy will be evaluated in encrypt,
* decrypt, and sign operations, and the operation will fail if rejected by
* the policy. The policy is defined by specifying zero or more allowed
* justification codes. https://cloud.google.com/assured-workloads/key-access-
* justifications/docs/justification-codes By default, this field is absent,
* and all justification codes are allowed. If the
* `key_access_justifications_policy.allowed_access_reasons` is empty (zero
* allowed justification code), all encrypt, decrypt, and sign operations will
* fail.
*
* @param KeyAccessJustificationsPolicy $keyAccessJustificationsPolicy
*/
public function setKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy $keyAccessJustificationsPolicy)
{
$this->keyAccessJustificationsPolicy = $keyAccessJustificationsPolicy;
}
/**
* @return KeyAccessJustificationsPolicy
*/
public function getKeyAccessJustificationsPolicy()
{
return $this->keyAccessJustificationsPolicy;
}
/**
* Labels with user-defined metadata. For more information, see [Labeling
* Keys](https://cloud.google.com/kms/docs/labeling-keys).
*
* @param string[] $labels
*/
public function setLabels($labels)
{
$this->labels = $labels;
}
/**
* @return string[]
*/
public function getLabels()
{
return $this->labels;
}
/**
* Output only. The resource name for this CryptoKey in the format
* `projects/locations/keyRings/cryptoKeys`.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* At next_rotation_time, the Key Management Service will automatically: 1.
* Create a new version of this CryptoKey. 2. Mark the new version as primary.
* Key rotations performed manually via CreateCryptoKeyVersion and
* UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time. Keys with
* purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this
* field must be omitted.
*
* @param string $nextRotationTime
*/
public function setNextRotationTime($nextRotationTime)
{
$this->nextRotationTime = $nextRotationTime;
}
/**
* @return string
*/
public function getNextRotationTime()
{
return $this->nextRotationTime;
}
/**
* Output only. A copy of the "primary" CryptoKeyVersion that will be used by
* Encrypt when this CryptoKey is given in EncryptRequest.name. The
* CryptoKey's primary version can be updated via
* UpdateCryptoKeyPrimaryVersion. Keys with purpose ENCRYPT_DECRYPT may have a
* primary. For other keys, this field will be omitted.
*
* @param CryptoKeyVersion $primary
*/
public function setPrimary(CryptoKeyVersion $primary)
{
$this->primary = $primary;
}
/**
* @return CryptoKeyVersion
*/
public function getPrimary()
{
return $this->primary;
}
/**
* Immutable. The immutable purpose of this CryptoKey.
*
* Accepted values: CRYPTO_KEY_PURPOSE_UNSPECIFIED, ENCRYPT_DECRYPT,
* ASYMMETRIC_SIGN, ASYMMETRIC_DECRYPT, RAW_ENCRYPT_DECRYPT, MAC,
* KEY_ENCAPSULATION
*
* @param self::PURPOSE_* $purpose
*/
public function setPurpose($purpose)
{
$this->purpose = $purpose;
}
/**
* @return self::PURPOSE_*
*/
public function getPurpose()
{
return $this->purpose;
}
/**
* next_rotation_time will be advanced by this period when the service
* automatically rotates a key. Must be at least 24 hours and at most 876,000
* hours. If rotation_period is set, next_rotation_time must also be set. Keys
* with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys,
* this field must be omitted.
*
* @param string $rotationPeriod
*/
public function setRotationPeriod($rotationPeriod)
{
$this->rotationPeriod = $rotationPeriod;
}
/**
* @return string
*/
public function getRotationPeriod()
{
return $this->rotationPeriod;
}
/**
* A template describing settings for new CryptoKeyVersion instances. The
* properties of new CryptoKeyVersion instances created by either
* CreateCryptoKeyVersion or auto-rotation are controlled by this template.
*
* @param CryptoKeyVersionTemplate $versionTemplate
*/
public function setVersionTemplate(CryptoKeyVersionTemplate $versionTemplate)
{
$this->versionTemplate = $versionTemplate;
}
/**
* @return CryptoKeyVersionTemplate
*/
public function getVersionTemplate()
{
return $this->versionTemplate;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(CryptoKey::class, 'Google_Service_CloudKMS_CryptoKey');