code: public final EncryptResponse encrypt(CryptoKeyPathName name, ByteString plaintext) {
  
      EncryptRequest request =
          EncryptRequest.newBuilder()
              .setName(name == null ? null : name.toString())
              .setPlaintext(plaintext)
              .build();
      return encrypt(request);
    }
docs: Encrypts data, so that it can only be recovered by a call to
  [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The
  [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be
  [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
  
  <p>Sample code:
  
  <pre><code>
  try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
  CryptoKeyPathName name = CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]");
  ByteString plaintext = ByteString.copyFromUtf8("");
  EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
  }
  </code></pre>
  
  @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or
  [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.
  <p>If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
  [primary version][google.cloud.kms.v1.CryptoKey.primary].
  @param plaintext Required. The data to encrypt. Must be no larger than 64KiB.
  <p>The maximum size depends on the key version's
  [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For
  [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the plaintext must be no
  larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined
  length of the plaintext and additional_authenticated_data fields must be no larger than
  8KiB.
  @throws com.google.api.gax.rpc.ApiException if the remote call fails