public synchronized String decrypt(String keyRingId, String keyId, String ciphertext) {

    CryptoKeyName keyName = CryptoKeyName.of(projectId, region, keyRingId, keyId);
    LOG.info("Decrypting given ciphertext using key {}.", keyName.toString());

    try (KeyManagementServiceClient client = clientFactory.getKMSClient()) {

      DecryptResponse response =
          client.decrypt(
              keyName,
              ByteString.copyFrom(
                  Base64.getDecoder().decode(ciphertext.getBytes(StandardCharsets.UTF_8))));

      LOG.info("Successfully decrypted ciphertext.");
      return response.getPlaintext().toStringUtf8();
    }
  }
@Test
  public void testDecryptShouldEncodeEncryptedMessageWithUTF8() {
    String ciphertext = "ciphertext";
    DecryptResponse decryptedResponse =
        DecryptResponse.newBuilder().setPlaintext(ByteString.copyFromUtf8(ciphertext)).build();
    String base64EncodedCiphertext =
        new String(
            Base64.getEncoder().encode(ciphertext.getBytes(StandardCharsets.UTF_8)),
            StandardCharsets.UTF_8);

    when(kmsClientFactory.getKMSClient()).thenReturn(serviceClient);
    when(serviceClient.decrypt(any(CryptoKeyName.class), any(ByteString.class)))
        .thenReturn(decryptedResponse);

    String actual = testManager.decrypt(KEYRING_ID, KEY_ID, base64EncodedCiphertext);

    verify(serviceClient)
        .decrypt(any(CryptoKeyName.class), eq(ByteString.copyFromUtf8(ciphertext)));
    assertThat(actual).isEqualTo(ciphertext);
  }