@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.DecryptRequest)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptRequest other = (com.google.cloud.kms.v1.DecryptRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getCiphertext().equals(other.getCiphertext()); result = result && getAdditionalAuthenticatedData().equals(other.getAdditionalAuthenticatedData()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + CIPHERTEXT_FIELD_NUMBER; hash = (53 * hash) + getCiphertext().hashCode(); hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; hash = (53 * hash) + getAdditionalAuthenticatedData().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Required. The encrypted data originally returned in * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. * </pre> * * <code>bytes ciphertext = 2;</code> */ public Builder clearCiphertext() { ciphertext_ = getDefaultInstance().getCiphertext(); onChanged(); return this; }
public Builder mergeFrom(com.google.cloud.kms.v1.DecryptRequest other) { if (other == com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.getCiphertext() != com.google.protobuf.ByteString.EMPTY) { setCiphertext(other.getCiphertext()); } if (other.getAdditionalAuthenticatedData() != com.google.protobuf.ByteString.EMPTY) { setAdditionalAuthenticatedData(other.getAdditionalAuthenticatedData()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void decryptTest() { ByteString plaintext = ByteString.copyFromUtf8("-9"); DecryptResponse expectedResponse = DecryptResponse.newBuilder().setPlaintext(plaintext).build(); mockKeyManagementService.addResponse(expectedResponse); CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); ByteString ciphertext = ByteString.copyFromUtf8("-72"); DecryptResponse actualResponse = client.decrypt(name, ciphertext); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockKeyManagementService.getRequests(); Assert.assertEquals(1, actualRequests.size()); DecryptRequest actualRequest = (DecryptRequest) actualRequests.get(0); Assert.assertEquals(name, CryptoKeyName.parse(actualRequest.getName())); Assert.assertEquals(ciphertext, actualRequest.getCiphertext()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.DecryptRequest)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptRequest other = (com.google.cloud.kms.v1.DecryptRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getCiphertext().equals(other.getCiphertext()); result = result && getAdditionalAuthenticatedData().equals(other.getAdditionalAuthenticatedData()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + CIPHERTEXT_FIELD_NUMBER; hash = (53 * hash) + getCiphertext().hashCode(); hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; hash = (53 * hash) + getAdditionalAuthenticatedData().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Required. The encrypted data originally returned in * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. * </pre> * * <code>bytes ciphertext = 2;</code> */ public Builder clearCiphertext() { ciphertext_ = getDefaultInstance().getCiphertext(); onChanged(); return this; }
public Builder mergeFrom(com.google.cloud.kms.v1.DecryptRequest other) { if (other == com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.getCiphertext() != com.google.protobuf.ByteString.EMPTY) { setCiphertext(other.getCiphertext()); } if (other.getAdditionalAuthenticatedData() != com.google.protobuf.ByteString.EMPTY) { setAdditionalAuthenticatedData(other.getAdditionalAuthenticatedData()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }