@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.AsymmetricDecryptResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.AsymmetricDecryptResponse other = (com.google.cloud.kms.v1.AsymmetricDecryptResponse) 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.AsymmetricDecryptResponse other) { if (other == com.google.cloud.kms.v1.AsymmetricDecryptResponse.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 encrypted with the matching public key. * </pre> * * <code>bytes plaintext = 1;</code> */ public Builder clearPlaintext() { plaintext_ = getDefaultInstance().getPlaintext(); onChanged(); return this; }
/** * Decrypt a given ciphertext using an 'RSA_DECRYPT_OAEP_2048_SHA256' private key * stored on Cloud KMS * * Example keyName: * "projects/PROJECT_ID/locations/global/keyRings/RING_ID/cryptoKeys/KEY_ID/cryptoKeyVersions/1" */ public static byte[] decryptRSA(String keyName, byte[] ciphertext) throws IOException { // Create the Cloud KMS client. try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) { AsymmetricDecryptResponse response = client.asymmetricDecrypt( keyName, ByteString.copyFrom(ciphertext)); return response.getPlaintext().toByteArray(); } } // [END kms_decrypt_rsa]
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.AsymmetricDecryptResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.AsymmetricDecryptResponse other = (com.google.cloud.kms.v1.AsymmetricDecryptResponse) 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.AsymmetricDecryptResponse other) { if (other == com.google.cloud.kms.v1.AsymmetricDecryptResponse.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 encrypted with the matching public key. * </pre> * * <code>bytes plaintext = 1;</code> */ public Builder clearPlaintext() { plaintext_ = getDefaultInstance().getPlaintext(); onChanged(); return this; }