class Aws::S3::EncryptionV2::IOEncrypter

def encrypt_to_stringio(cipher, plain_text)

def encrypt_to_stringio(cipher, plain_text)
  if plain_text.empty?
    StringIO.new(cipher.final + cipher.auth_tag)
  else
    StringIO.new(cipher.update(plain_text) + cipher.final + cipher.auth_tag)
  end
end