Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit f4e58f2

Browse files
feat: add client integrity verification fields to the KMS protos (#234)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * Add client integrity verification fields to the KMS protos PiperOrigin-RevId: 326100874 Source-Author: Google APIs <noreply@google.com> Source-Date: Tue Aug 11 14:22:10 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: b40e4533f841c96aac1d9d7d342514d146b5b4cb Source-Link: googleapis/googleapis@b40e453
1 parent bf28a63 commit f4e58f2

27 files changed

+7372
-378
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ If you are using Maven without BOM, add this to your dependencies:
4848

4949
If you are using Gradle, add this to your dependencies
5050
```Groovy
51-
compile 'com.google.cloud:google-cloud-kms:1.39.1'
51+
compile 'com.google.cloud:google-cloud-kms:1.39.0'
5252
```
5353
If you are using SBT, add this to your dependencies
5454
```Scala
55-
libraryDependencies += "com.google.cloud" % "google-cloud-kms" % "1.39.1"
55+
libraryDependencies += "com.google.cloud" % "google-cloud-kms" % "1.39.0"
5656
```
5757
[//]: # ({x-version-update-end})
5858

google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public final UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCal
529529
/**
530530
* Sets the access control policy on the specified resource. Replaces any existing policy.
531531
*
532-
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
532+
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
533533
*
534534
* <p>Sample code:
535535
*
@@ -617,7 +617,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
617617
/**
618618
* Sets the access control policy on the specified resource. Replaces any existing policy.
619619
*
620-
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
620+
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
621621
*
622622
* <p>Sample code:
623623
*
@@ -738,7 +738,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
738738
// AUTO-GENERATED DOCUMENTATION AND METHOD
739739
/**
740740
* Returns permissions that a caller has on the specified resource. If the resource does not
741-
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
741+
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
742742
*
743743
* <p>Note: This operation is designed to be used for building permission-aware UIs and
744744
* command-line tools, not for authorization checking. This operation may "fail open" without
@@ -840,7 +840,7 @@ public final TestIamPermissionsResponse testIamPermissions(
840840
// AUTO-GENERATED DOCUMENTATION AND METHOD
841841
/**
842842
* Returns permissions that a caller has on the specified resource. If the resource does not
843-
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
843+
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
844844
*
845845
* <p>Note: This operation is designed to be used for building permission-aware UIs and
846846
* command-line tools, not for authorization checking. This operation may "fail open" without

google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,11 @@ public void getCryptoKeyVersionExceptionTest() throws Exception {
706706
@SuppressWarnings("all")
707707
public void getPublicKeyTest() {
708708
String pem = "pem110872";
709-
PublicKey expectedResponse = PublicKey.newBuilder().setPem(pem).build();
709+
PublicKeyName name2 =
710+
PublicKeyName.of(
711+
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
712+
PublicKey expectedResponse =
713+
PublicKey.newBuilder().setPem(pem).setName(name2.toString()).build();
710714
mockKeyManagementService.addResponse(expectedResponse);
711715

712716
CryptoKeyVersionName name =
@@ -1054,8 +1058,15 @@ public void updateCryptoKeyVersionExceptionTest() throws Exception {
10541058
public void encryptTest() {
10551059
String name2 = "name2-1052831874";
10561060
ByteString ciphertext = ByteString.copyFromUtf8("-72");
1061+
boolean verifiedPlaintextCrc32c = false;
1062+
boolean verifiedAdditionalAuthenticatedDataCrc32c = true;
10571063
EncryptResponse expectedResponse =
1058-
EncryptResponse.newBuilder().setName(name2).setCiphertext(ciphertext).build();
1064+
EncryptResponse.newBuilder()
1065+
.setName(name2)
1066+
.setCiphertext(ciphertext)
1067+
.setVerifiedPlaintextCrc32C(verifiedPlaintextCrc32c)
1068+
.setVerifiedAdditionalAuthenticatedDataCrc32C(verifiedAdditionalAuthenticatedDataCrc32c)
1069+
.build();
10591070
mockKeyManagementService.addResponse(expectedResponse);
10601071

10611072
ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
@@ -1140,8 +1151,14 @@ public void decryptExceptionTest() throws Exception {
11401151
@SuppressWarnings("all")
11411152
public void asymmetricSignTest() {
11421153
ByteString signature = ByteString.copyFromUtf8("106");
1154+
boolean verifiedDigestCrc32c = true;
1155+
String name2 = "name2-1052831874";
11431156
AsymmetricSignResponse expectedResponse =
1144-
AsymmetricSignResponse.newBuilder().setSignature(signature).build();
1157+
AsymmetricSignResponse.newBuilder()
1158+
.setSignature(signature)
1159+
.setVerifiedDigestCrc32C(verifiedDigestCrc32c)
1160+
.setName(name2)
1161+
.build();
11451162
mockKeyManagementService.addResponse(expectedResponse);
11461163

11471164
CryptoKeyVersionName name =
@@ -1187,8 +1204,12 @@ public void asymmetricSignExceptionTest() throws Exception {
11871204
@SuppressWarnings("all")
11881205
public void asymmetricDecryptTest() {
11891206
ByteString plaintext = ByteString.copyFromUtf8("-9");
1207+
boolean verifiedCiphertextCrc32c = true;
11901208
AsymmetricDecryptResponse expectedResponse =
1191-
AsymmetricDecryptResponse.newBuilder().setPlaintext(plaintext).build();
1209+
AsymmetricDecryptResponse.newBuilder()
1210+
.setPlaintext(plaintext)
1211+
.setVerifiedCiphertextCrc32C(verifiedCiphertextCrc32c)
1212+
.build();
11921213
mockKeyManagementService.addResponse(expectedResponse);
11931214

11941215
CryptoKeyVersionName name =

0 commit comments

Comments
 (0)