Git Product home page Git Product logo

Comments (7)

jmazzi avatar jmazzi commented on August 29, 2024

@Capncavedan which encryptor are you using?

from crypt_keeper.

Capncavedan avatar Capncavedan commented on August 29, 2024

The default AES encryptor, like so:

crypt_keeper :social_security_number, encryptor: :aes, key: "super secret"

from crypt_keeper.

jmazzi avatar jmazzi commented on August 29, 2024

One option I can think of is creating a "strict" mode for the AES encryptor, and others really. That would be the default mode. In strict mode, you would receive errors for nil or empty values, like you currently do. In non strict mode:

crypt_keeper :social_security_number, encryptor: :aes, key: "super secret", strict: false

the original value you would be returned for nil or empty strings for decrypt and encrypt. It would look something like this:

def encrypt(value)
  if value.blank? && strict_mode
    value
  else
    # encryption
  end
end

def decrypt(value)
  if value.blank? && strict_mode
    value
  else
    # decryption
  end
end

How do you feel about creating a pull request to do that?

from crypt_keeper.

jmazzi avatar jmazzi commented on August 29, 2024

@Capncavedan let me know what you think about that.

from crypt_keeper.

Capncavedan avatar Capncavedan commented on August 29, 2024

I think that sounds pretty good, @jmazzi.

I'll work on a pull request.

Note that nil and non-empty strings, e.g. " ", don't generate problems with AES, at least in my experience so far. Just the empty string.

from crypt_keeper.

jmazzi avatar jmazzi commented on August 29, 2024

Hmm, well I'm not sure that's a issue with crypt_keeper then. Non empty strings have a value.

On Friday, March 8, 2013 at 5:07 PM, Dan Buettner wrote:

I think that sounds pretty good, @jmazzi (https://github.com/jmazzi).
I'll work on a pull request.
Note that nil and non-empty strings, e.g. " ", don't generate problems with AES, at least in my experience so far. Just the empty string.


Reply to this email directly or view it on GitHub (#31 (comment)).

from crypt_keeper.

jmazzi avatar jmazzi commented on August 29, 2024

closed by #35

from crypt_keeper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.