protected final PutObjectRequest createInstructionPutRequest(
     String bucketName, String key, ContentCryptoMaterial cekMaterial) {
   byte[] bytes = cekMaterial.toJsonString().getBytes(UTF8);
   InputStream is = new ByteArrayInputStream(bytes);
   ObjectMetadata metadata = new ObjectMetadata();
   metadata.setContentLength(bytes.length);
   metadata.addUserMetadata(Headers.CRYPTO_INSTRUCTION_FILE, "");
   return new PutObjectRequest(bucketName, key + INSTRUCTION_SUFFIX, is, metadata);
 }
 /**
  * Updates put request to store the specified instruction object in S3.
  *
  * @param request The put request for the original object to be stored in S3.
  * @param cekMaterial The instruction object to be stored in S3.
  * @return A put request to store the specified instruction object in S3.
  */
 protected final PutObjectRequest upateInstructionPutRequest(
     PutObjectRequest request, ContentCryptoMaterial cekMaterial) {
   byte[] bytes = cekMaterial.toJsonString().getBytes(UTF8);
   InputStream is = new ByteArrayInputStream(bytes);
   ObjectMetadata metadata = request.getMetadata();
   if (metadata == null) {
     metadata = new ObjectMetadata();
     request.setMetadata(metadata);
   }
   // Set the content-length of the upload
   metadata.setContentLength(bytes.length);
   // Set the crypto instruction file header
   metadata.addUserMetadata(Headers.CRYPTO_INSTRUCTION_FILE, "");
   // Update the instruction request
   request.setKey(request.getKey() + INSTRUCTION_SUFFIX);
   request.setMetadata(metadata);
   request.setInputStream(is);
   request.setFile(null);
   return request;
 }