python - Storing a service account with Flask-SQLAlchemy -


i'm writing small hipchat plugin using flask , flask-sqlalchemy local database. want admin able setup service account external service meant integrate with.

because username/password of service accounts needs stored can used integration make api calls can't use non-reversible hashing methods storing password.

are there recommendations how approach passwords or database can better secured?

you can encrypt data before storing them in database. pycrypto 1 of libraries can utilize.

it easy encrypt text using des/ecb pycrypto. key ‘10234567’ 8 bytes , text’s length needs multiple of 8 bytes. picked ‘abcdefgh’ in example.

>>> crypto.cipher import des >>> des = des.new('01234567', des.mode_ecb) >>> text = 'abcdefgh' >>> cipher_text = des.encrypt(text) >>> cipher_text '\xec\xc2\x9e\xd9] a\xd0' >>> des.decrypt(cipher_text) 'abcdefgh' 

here short article pycrypto.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -