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

Commit

Permalink
feat: add client integrity verification fields to the KMS protos (#234)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
yoshi-automation committed Aug 13, 2020
1 parent bf28a63 commit f4e58f2
Show file tree
Hide file tree
Showing 27 changed files with 7,372 additions and 378 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -48,11 +48,11 @@ If you are using Maven without BOM, add this to your dependencies:

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

Expand Down
Expand Up @@ -529,7 +529,7 @@ public final UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCal
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -617,7 +617,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -738,7 +738,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that a caller has on the specified resource. If the resource does not
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* <p>Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
Expand Down Expand Up @@ -840,7 +840,7 @@ public final TestIamPermissionsResponse testIamPermissions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that a caller has on the specified resource. If the resource does not
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* <p>Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
Expand Down
Expand Up @@ -706,7 +706,11 @@ public void getCryptoKeyVersionExceptionTest() throws Exception {
@SuppressWarnings("all")
public void getPublicKeyTest() {
String pem = "pem110872";
PublicKey expectedResponse = PublicKey.newBuilder().setPem(pem).build();
PublicKeyName name2 =
PublicKeyName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
PublicKey expectedResponse =
PublicKey.newBuilder().setPem(pem).setName(name2.toString()).build();
mockKeyManagementService.addResponse(expectedResponse);

CryptoKeyVersionName name =
Expand Down Expand Up @@ -1054,8 +1058,15 @@ public void updateCryptoKeyVersionExceptionTest() throws Exception {
public void encryptTest() {
String name2 = "name2-1052831874";
ByteString ciphertext = ByteString.copyFromUtf8("-72");
boolean verifiedPlaintextCrc32c = false;
boolean verifiedAdditionalAuthenticatedDataCrc32c = true;
EncryptResponse expectedResponse =
EncryptResponse.newBuilder().setName(name2).setCiphertext(ciphertext).build();
EncryptResponse.newBuilder()
.setName(name2)
.setCiphertext(ciphertext)
.setVerifiedPlaintextCrc32C(verifiedPlaintextCrc32c)
.setVerifiedAdditionalAuthenticatedDataCrc32C(verifiedAdditionalAuthenticatedDataCrc32c)
.build();
mockKeyManagementService.addResponse(expectedResponse);

ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
Expand Down Expand Up @@ -1140,8 +1151,14 @@ public void decryptExceptionTest() throws Exception {
@SuppressWarnings("all")
public void asymmetricSignTest() {
ByteString signature = ByteString.copyFromUtf8("106");
boolean verifiedDigestCrc32c = true;
String name2 = "name2-1052831874";
AsymmetricSignResponse expectedResponse =
AsymmetricSignResponse.newBuilder().setSignature(signature).build();
AsymmetricSignResponse.newBuilder()
.setSignature(signature)
.setVerifiedDigestCrc32C(verifiedDigestCrc32c)
.setName(name2)
.build();
mockKeyManagementService.addResponse(expectedResponse);

CryptoKeyVersionName name =
Expand Down Expand Up @@ -1187,8 +1204,12 @@ public void asymmetricSignExceptionTest() throws Exception {
@SuppressWarnings("all")
public void asymmetricDecryptTest() {
ByteString plaintext = ByteString.copyFromUtf8("-9");
boolean verifiedCiphertextCrc32c = true;
AsymmetricDecryptResponse expectedResponse =
AsymmetricDecryptResponse.newBuilder().setPlaintext(plaintext).build();
AsymmetricDecryptResponse.newBuilder()
.setPlaintext(plaintext)
.setVerifiedCiphertextCrc32C(verifiedCiphertextCrc32c)
.build();
mockKeyManagementService.addResponse(expectedResponse);

CryptoKeyVersionName name =
Expand Down

0 comments on commit f4e58f2

Please sign in to comment.