Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:17:20+00:00 2026-06-04T06:17:20+00:00

I am using the ActiveRecord serialize method with a class of my own, AESCoder

  • 0

I am using the ActiveRecord serialize method with a class of my own, AESCoder. This will uses aes-256-cbc with a random initialization vector every time. This initialization vector is prepended to the field when I store it in the database, and is of course extracted before deserializing.

Now, this scheme prevents me from using any finders on those attributes. I have to select all the rows I need, which will be automatically decrypted, and the perform a ruby select on the item list. This is, of course, a huge performance bottleneck, which I can’t afford for this application.

One solution would be not to use a random IV, but then aes-256-cbc wouldn’t be as secure any more.

Am I overlooking something here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:17:22+00:00Added an answer on June 4, 2026 at 6:17 am

    As others have noted, there will be no way around the need to decrypt rows you want to search through. Still you might improve performance by letting Postgres do the heavy lifting with the help of its pgcrypto extension, instead of selecting everything and sorting it out on the application layer.

    Heroku recently started offering Postgres 9.1 and seems to support pgcrypto. According to the blog post, you may have to migrate your database in order to be switched over to Postgres 9.1.

    Please note that Herokus paid ‘shared database’ plans still seem to run on Postgres 8 and do not support pgcrypto yet, but are supposed to be upgraded shortly. Postgres 9 introduced a new way to enable and use extensions that makes it easier to offer them in a shared hosting environment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Rails 3 w/ Mongoid, (so no ActiveRecord). Mongoid uses ActiveModel's to_json method,
I've developed my own custom users and roles objects using ActiveRecord that do NOT
I have a model like this class Parent < ActiveRecord::Base :has_many :kids end class
I try to serialize an instance of my ActiveRecord model to JSON (using render
Anyone know how I can create this query using ActiveRecord rather than using SQL?
I have the following model: class Deck < ActiveRecord::Base has_many :cards serialize :stats attr_accessible
I'm using ActiveRecord to maintain information about users. The User class has the expected
I am using ActiveRecord and when I call Model.Save which calls repositry.Update and then
Is there a way to create mysql triggers using Activerecord migrations ? Has anybody
Question: I really am trying to stick to using ActiveRecord and not using straight

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.