@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.DecryptResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptResponse other = (com.google.cloud.kms.v1.DecryptResponse) obj; boolean result = true; result = result && getPlaintext().equals(other.getPlaintext()); 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) + PLAINTEXT_FIELD_NUMBER; hash = (53 * hash) + getPlaintext().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.kms.v1.DecryptResponse other) { if (other == com.google.cloud.kms.v1.DecryptResponse.getDefaultInstance()) return this; if (other.getPlaintext() != com.google.protobuf.ByteString.EMPTY) { setPlaintext(other.getPlaintext()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * * * <pre> * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. * </pre> * * <code>bytes plaintext = 1;</code> */ public Builder clearPlaintext() { plaintext_ = getDefaultInstance().getPlaintext(); onChanged(); return this; }
/** * Decrypts the provided ciphertext with the specified crypto key. */ public static byte[] decrypt( String projectId, String locationId, String keyRingId, String cryptoKeyId, byte[] ciphertext) throws IOException { // Create the KeyManagementServiceClient using try-with-resources to manage client cleanup. try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) { // The resource name of the cryptoKey String resourceName = CryptoKeyName.format(projectId, locationId, keyRingId, cryptoKeyId); // Decrypt the ciphertext with Cloud KMS. DecryptResponse response = client.decrypt(resourceName, ByteString.copyFrom(ciphertext)); // Extract the plaintext from the response. return response.getPlaintext().toByteArray(); } } // [END kms_decrypt]
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.DecryptResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptResponse other = (com.google.cloud.kms.v1.DecryptResponse) obj; boolean result = true; result = result && getPlaintext().equals(other.getPlaintext()); 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) + PLAINTEXT_FIELD_NUMBER; hash = (53 * hash) + getPlaintext().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.kms.v1.DecryptResponse other) { if (other == com.google.cloud.kms.v1.DecryptResponse.getDefaultInstance()) return this; if (other.getPlaintext() != com.google.protobuf.ByteString.EMPTY) { setPlaintext(other.getPlaintext()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * * * <pre> * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. * </pre> * * <code>bytes plaintext = 1;</code> */ public Builder clearPlaintext() { plaintext_ = getDefaultInstance().getPlaintext(); onChanged(); return this; }