Giter Club home page Giter Club logo

encrypt_attributes's Introduction

⚔️ Degica Quest ⚔️

Welcome brave Ruby warrior. An epic adventure awaits you.

🛠 How to Play

Install the rubygem

gem install degica

And then execute:

$ degica

💪 Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/degica/degica. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

©️ License

MIT

encrypt_attributes's People

Contributors

alessandrominali avatar camelmasa avatar ftlam11 avatar iorin0225 avatar k2nr avatar kenta-s avatar pmq20 avatar reneos avatar resonious avatar shioyama avatar thoiberg avatar yuuki77 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

shioyama

encrypt_attributes's Issues

Need to support cipher updates

Context

This library is pretty old, and thus the encryption scheme used is slightly outdated. We have a ton of already-encrypted data in our production database, so we need a feature that allows us to support old and new schemes simultaneously.

Things that need to be changeable

  1. Cipher type (right now we are stuck on aes-256-cbc)
  2. Password hashing (stuck on PKCS5 1.5)

One possible way to do it

We'll have to encode a plaintext "version" alongside our ciphertexts. Since we're using base64, we can safely prefix new payloads with a special character, followed by a version number.

# Old:
U2FsdGVkX19hYmNkZWZnaNP1CILqdQwlmuFn9x/Yr9s=\n

# New:
-v1-U2FsdGVkX19hYmNkZWZnaNP1CILqdQwlmuFn9x/Yr9s=\n

Before decrypting, we'll first see if the ciphertext starts with -.
If it does not start with -, we will decrypt using good ole' aes-256-cbc and PKCS5 1.5.
If it does start with -, we read the version string. We can make up new version strings for any new encryption scheme in the future.

Return nil when data is nil

We have a difficulty in a client which uses this library where we had data extracted from the db and passed to this code, only for it to throw an unexpected type exception. This was because the library cannot handle nil as an input.

When on this line, data is nil

@cipher.update(data) + @cipher.final

It throws a TypeError: no implicit conversion of nil into String, which makes sense in this context but is cryptic in the client application.

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.