[SOLVED] Encrypting (or protecting) a Python password

I have a script which accesses my Facebook and lets me know when I have notifications, etc.  However, within the script, my password is currently in plain-text; I see this as a security flaw for obvious reasons.  After Google searching, I couldn't really find a solid answer on encryption methods for passwords in a situation like this, and, to be honest, I know very little about cryptography. 
I was hoping to get some ideas, solutions, or confirmation of existing solutions, for keeping my password safe and accessible to my script; it would be nice to hear from someone with working knowledge on the subject, but any and all help would be appreciated.
http://stackoverflow.com/questions/1020 … pt-decrypt
http://stackoverflow.com/questions/1867 … encryption
Last edited by apolyonn (2014-03-16 16:29:16)

Then you're probably fine.
Your post #5 has a few extra questions in it I want to clarify, since I kind of ignored them earlier:
apolyonn wrote:For instance, when phone applications (ie, Facebook App) store your credentials, are they storing it with secure protection methods; if not, why are they used without question -- and without being exploited en masse?  Also, I've heard a lot of good things about GPG, as x33a suggested; but, if this type of encryption is useless, then I must ask what the difference is between "client-side encryption" and encryption in general, and if either will really protect information.
I have no idea how Facebook App (or any other app) stores passwords. But, even if an app stores passwords in plain text, an attacker still has to gain read access to your individual phone in order to actually *read* them. Plain text passwords are as secure as the device they're stored on; encrypted passwords are as secure as the device the decryption key is stored on. When an encrypted password is stored alongside its own decryption key, it might as well be stored in plain text. I hope this kind of addresses the question of why plain text passwords aren't susceptible to mass exploitation (or, at least, why they're no more susceptible than encrypted passwords).
But encryption in storage (I said "client-side" earlier) is different from the issue of in transit encryption, which is what prevents an attacker from snooping on passwords being sent through unsafe channels (such as open Wi-Fi networks, or any network not owned by someone you absolutely trust). Facebook probably uses HTTPS for this purpose, and that's what encrypts your credentials whenever they're actually being sent across the Internet. What makes it safe is that only Facebook has the private key that can decrypt your HTTPS messages.
GPG used correctly is similar to HTTPS: strong encryption, beyond kid-sister level. (At least until D-Wave or somebody makes a quantum computer capable of factoring large numbers quickly.) But encryption alone doesn't make your data safe; you must also keep secret the decryption keys.

Similar Messages

  • "pdf. protected by a password" error for a few users only

    Hi
    Lately I have had complaints that some of the users of my website are getting "pdf. protected by a password" errors when trying to open PDF files from our website. The files are created using abdpdf (abcpdf3.dll). For 99% of our userbase there seems to be no problem but for some we are now encountering this error. There is no password required to open the file (although there is an encryption owner password set), and the only other settings we have are that the ability to change, copy and edit are all set to false.
    There doesn't seem to be a common denominator in regards to environments that the users encountering the problem are using.
    Mac or PC users,  Windows XP/7 etc, IE, Firefox, Chrome etc.
    Just for clarification, the users are only trying to open the pdf, not edit it.
    Has anyone else encountered this issue?
    Thanks
    Steve

    It appears that this may be an issue with Firefox 25 (it seems I was misinformed about the other browsers).
    Info I got from a user:
    The error only happens in Firefox Ver 25 I tried ver 24 and it worked OK an it also works on Internet Explorer or saving the link and opening the document with Adobe reader.
    System info Windows 8.1
    Firefox Ver 25
    If this is the case is this the forum that I should be looking for answers on or should I go to Firefox for answers?
    Thanks

  • Can rman script be encrypted to protect the source?

    Hi,
    As a solution provider, is it possible to encrypt rman script be encrypted to protect the source?
    thanks
    andrew

    I think the best you can do is to use Oracle Encryption Wallet to store credentials for connecting to databases or use Password Encryption to create RMAN Encrypted Backups.
    http://docs.oracle.com/cd/B19306_01/backup.102/b14191/rcmbackp.htm
    http://docs.oracle.com/cd/B19306_01/network.102/b14266/cnctslsh.htm#i1006413

  • Password protected without a password

    I was attempting to password protect my adobe .pdf but it never gave me the screen to enter the password I wanted to use. Now the document is password protected without a password and I cannot open it.  Please help.

    I think i might have the same issue as MymicFSO.
    The issue is when you try to go to secure>manage security policies by default there would be 2 entries
    Encrypt with certificate
    Encrypt with Password option
    For the second if i check on the policy details both user password and owner password are set to "Not Required"
    So if I try to secure a document and choose the "Encrypt a password" option, since there is no default password setup then it will prompt me to enter what ever password I choose.
    Now on another computer someone changed the setting and chose to put in a password for the "User password" under the "Encrypt a password" policy. So now whenever I secure a document using that machine using "Encrypt a Password" it uses the one already stored and does not prompt me to enter a new password.
    Now it can still be changed by by to the password security settings manually but I wonder if it is possible to get back that option for it to just prompt me whenever i try to secure a document.

  • Remove encryption or protection for many PDFs in Action Wizard?

    Hello,
    I can remove encryption manually for each PDF file, but I have hundreds of files so it is impossible to do it manually.
    From what I know, in Action Wizard, I can only add encryption for many files, there seems to be no 'encryption remove' function in Action Wizard for me to apply to many files.
    So, my question is, how do I remove encryption for many PDF files at once without having to so manually?
    Thank you.

    Sir, what you said makes perfect sense but it may work only in case the files are protected with a password.
    This case seems different.
    I remove the protection manually by choosing Protection --> Encrypt --> Remove.
    No password whatsoever.
    After that, I am able to Edit Object, Edit Document Text, Add or Edit Text Box.
    To make sure I followed your steps correctly, this is how I did it:
    http://img141.imageshack.us/img141/3079/screenshot20110315at616.png

  • I want to create a form with a manager completing one section and a staff member another. Both sections protected by different passwords.

    I want to create a form with a manager completing one section and a staff member another. Neither should be able to edit the others. Can different sections be password protected by different passwords? I'm thinking there might be an "official use only" function.

    You can use 2 forms in one portfolio.

  • HT4946 i want to backup my iPhone to my new iMac but my backup is selected to Encrypt Local backup and my password does not work.

    I am trying to backup my iPhone on my new iMac iTunes. It is currently backed up on my PC  and encrypted. Both PC and iMac iTunes have Encrypted backup selected. My password does not work for either iMac or PC. Should I go ahead and try to backup to my iMac iTunes.

    Sorry to hear about your phone jb111jb! We'll do everything we can to help find the best route! The only way to remove the password is flashing the device, but that will erase all the content. Have you ever backed up using Verizon Cloud or Google Sync? Do you have a memory card?
    AshleyS_VZW
    Follow us on Twitter @VZWSupport  

  • I lost my ipod touch which is not protected by a password, how to remove email info?

    Hi,
    I lost my ipod touch which is not protected by a password. How can I prevent the new 'owner' to have access to my email? I changed my email password already, but I'm wondering if one can still have access to the email without entering the new password, (it is the case with my new phone, nexus5), since the mail app automatically syncs with my email...
    Thanks
    Carmen

    Did you have Find My iPhone turned on on the device?
    If so, go to https://www.icloud.com/ and go to Find My iPhone. Click on the iPod, and even if it is no online, set it to Lost Mode. You can lock it and put a message on it. Once it comes back online, it will be locked.
    Cheers,
    GB

  • What type of encryption is firefox using for password protection and how trustworthy is it

    I would like to know what kind of encryption FF uses and how I know I can trust it? This is not a bone of contention with FF, I love the product, rather it is just a concern I have that will convince me to let FF manage my financial passwords. Thanks for any assistance with understanding this issue more completely.

    The degree of protection very much depends on how strong your master password is.
    When using a master password, the data is encrypted using [http://www.tropsoft.com/strongenc/des3.html Triple DES Encryption in CBC mode]. This level of encryption is good for general purpose use. The weak point it the master password, if you have a weak master password there are programs available that will be able to crack the master password, they often do this by using a brute force method. If you use a strong master password, the brute force method will need a very long time to crack passwords. For details on password strength and creating strong passwords see http://en.wikipedia.org/wiki/Password_strength and http://luxsci.com/blog/security-simplified-the-basesuffix-method-for-memorable-strong-passwords.html

  • How to protect Developer know Password of Schema in Production system?

    Hi, I'm newbies about Database Securities.
    My new job have environment about Client/Server by Oracle10gR2 working with Delphi Application.
    I found developer fixed schmea user/password on program code for connect to DB.
    So, Now password of Production Schema is same with Development Schema
    and Developer can access to Production environment.
    How to solve this situaltion?, I think maybe ever have best pratice for this.
    I think about keep password on other location and Application get to use for connect DB.
    Howerver, This way developer can coding for print out password to see it.
    Or maybe DBA must change fix password in Programmer coding before migrate to production (It's no good). To do that, DBA can change password of Production and Developerment to differrence.
    Now we protect this by trigger to fix about protect Developer connect DB by Tools (by osuser, machine and program filed in v$session). I know this can leak by change osuser, change exec name of Tools.
    Previouse job use Oracle DB with E-Business suite. It's no this problem cause of It's have interface to manage connection between App & DB.
    Thank you for every advice.
    Best Regards,

    Hi, I'm newbies about Database Securities.
    My new job have environment about Client/Server by Oracle10gR2 working with Delphi Application.
    I found developer fixed schmea user/password on program code for connect to DB.
    So, Now password of Production Schema is same with Development Schema
    and Developer can access to Production environment.
    How to solve this situaltion?, I think maybe ever have best pratice for this.
    I think about keep password on other location and Application get to use for connect DB.
    Howerver, This way developer can coding for print out password to see it.
    Or maybe DBA must change fix password in Programmer coding before migrate to production (It's no good). To do that, DBA can change password of Production and Developerment to differrence.
    Now we protect this by trigger to fix about protect Developer connect DB by Tools (by osuser, machine and program filed in v$session). I know this can leak by change osuser, change exec name of Tools.
    Previouse job use Oracle DB with E-Business suite. It's no this problem cause of It's have interface to manage connection between App & DB.
    Thank you for every advice.
    Best Regards,

  • Reader plug-in, save copy of password protected pdf without password

    Hello,
    We currently have an Acrobat Reader plugin (using the 8.1 SDK) and are having trouble with password protected PDFs.
    The sole purpose of our plug-in is to pass a copy of the currently open PDF to a different folder on the user's computer. The problem we are facing is with the password protected PDFs. We would like to pass a copy of the PDF that doesn't have the readonly password protection.
    Scenario:
    1. The user opens a password protected PDF in Adobe Reader.
    2. They are prompted for the password, they enter it and can see the PDF. 3. Now they click our custom button.
    4. Save a copy of the currently open PDF without password protection
    Since we already know they have entered the correct password, in theory we should be able to either save all of the content to a new file, or simply remove the password protection.
    Can anyone point me in the right direction so that I will be able to get a PDF without the password?
    Thanks,
    Ryan

    Hi again,
    I was doing some research in the API reference and examples and I think that for my business problem, it will be sufficient if I can get the read access password. I found that I am able to use the following:
    AVCryptGetPassword(pdDoc, permsWanted, (void **)&password)
    This prompts the user to enter the password and puts the actual password in the &password variable, which will will work for us. Ideally though, I would like to not have to prompt the user again for the password since they already entered when opening the pdf, is it possible to get access to the plain text of the password that they typed when opening the pdf or another way?
    I tried:
    StdSecurityDataRec* secData;
    secData = (StdSecurityDataRec*)PDDocGetNewSecurityData (pdDoc);
    if (secData) {
    if (secData->hasUserPW)
    char* mypw = secData->userPW;
    However, the password is encrypted. Thanks for your help!
    Thanks,
    Ryan

  • New iPad asks for WiFi password. There is none. My WiFi uses WEP 128 bit encryption, but there is no "password" to enter.

    Brand new to the iPad. It's asking for a password to the WiFi network in my home. There is no "password" as such associated with this WiFi network. It uses WEP 128 bit encryption where each byte is a hexadecimal number and is called a "key" Typing this lengthy thing in gives me no results. The iPad keeps on asking for a password. I have three computers and a DVD hooked to the network which has been working for a decade, so that's not the issue.
    Basically I'm stuck not being able to get onto the WiFi system.

    iOS 6 Wifi Problems/Fixes
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting
    http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet
    http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • C# Protect file with password

    Hello,
    I am creating a notepad where you can protect a file with an password. Try to imagine it as a protected .zip file with username and password, but in this case it's about an text file with a other file extension (.cpd). I tried a lot of codes, but they don't
    work. So the question to you guys is: How do i protect a text file (or .cpd file) with C#?
    I created the form with the username textBox and the password textBox (+ the login button)
    I have experience with C#, but i stay an beginner
    Thanks,
    Hugo Woesthuis

    how do i make the text file in an other coding, so no one can read the text  in Notepad, Word , etc
    Hi,
    Here is an example:
    private void button_Click(object sender, EventArgs e)
    //Filename
    string _filename = @"C:\test\testfile.txt";
    //Write data to file
    FileIO.WriteEncryptedFile(_filename, "HELLO");
    //Read data from file
    System.Console.WriteLine("File content: " + FileIO.ReadEncryptedfile(_filename));
    File input / output class:
    public class FileIO
    public static void WriteEncryptedFile(string filename, string data)
    using (StreamWriter _streamWriter = new StreamWriter(filename, true))
    _streamWriter.Write(new Crypto().Encrypt(data));
    public static string ReadEncryptedfile(string filename)
    using (StreamReader _streamReader = new StreamReader(filename))
    return new Crypto().Decrypt(_streamReader.ReadToEnd());
    Encryption / decryption class:
    class Crypto
    byte[] _key { get; set; }
    byte[] _iv { get; set; }
    public Crypto()
    _key = Encoding.Default.GetBytes("ABCDEFGHIJKLMNOP");
    _iv = Encoding.Default.GetBytes("ABCDEFGHIJKLMNOP");
    public string Encrypt(string data)
    using(ICryptoTransform _iCrypto = new TripleDESCryptoServiceProvider().CreateEncryptor(_key, _iv))
    var _byteData = Encoding.Default.GetBytes(data);
    var _encryptedData = _iCrypto.TransformFinalBlock(_byteData, 0, _byteData.Length);
    return Convert.ToBase64String(_encryptedData, 0, _encryptedData.Length);
    public string Decrypt(string data)
    using (ICryptoTransform _iCrypto = new TripleDESCryptoServiceProvider().CreateDecryptor(_key, _iv))
    var _byteData = Convert.FromBase64String(data);
    var _decryptedData = _iCrypto.TransformFinalBlock(_byteData, 0, _byteData.Length);
    return Encoding.Default.GetString(_decryptedData);
    Remember to change the key and IV in the constructor of the Crypto class, key must be between 16-24 characters long.

  • [SOLVED] Encrypted root on USB drive problem

    Hi,
    I have encrypted root on external USB harddrive. On one machine it works just fine, LUKS ask for password and system starts.
    On second it does not work. I tryed nearly all possible combinations of modules and hooks. I can also access my usb drive if I use break=y. I am using current kernel & utils, I definitely use right paths...
    Machine is an Dell with Intel chipset. My USB drive is like this:
      /dev/sdb1 - big fat32
      /dev/sdb2 - ext2 boot with Grub, kernel and initrd image
      /dev/sdb3 - root fs, reiserfs encrypted with LUKS
    I made little debuging and it seems that encrypt hook was launched, but did not make anything. Before I digg deeper I wonder that someone had same problem, or can give me advice.
    Kernel panic screenshot:
    PS: how can I put busybox to initrd image? echo * sucks.
    Thanks
    Last edited by Trained.Monkey (2007-10-10 09:42:13)

    I solved, problem is that encrypt is running BEFORE usb drive is fully initialized. Encrypted partition is not found and not used.
    Solotion:
    put sleep 5 at beggining of encrypt hook. You must also add sleep binary at installer.

  • Python password module

    I got bored and wrote a password module for python. Enjoy.
    #!/usr/bin/python
    # pypasswd.py
    # Written By: Tyler Gates
    import os, sys, crypt, string, getpass
    from random import choice
    class password:
    MD5saltprefix = "$1$"
    DESsaltprefix = ""
    valid_salt_set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/."
    valid_password_set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[]^_`{|}~\ "
    def gen_random(self, set, length):
    """ generate random string length long from set """
    random_string = ""
    for i in range(length):
    random_string = random_string + choice(set)
    return random_string
    def gen_MD5salt(self):
    """ generate a random MD5 salt eight long """
    return self.MD5saltprefix + self.gen_random(self.valid_salt_set, 8)
    def gen_DESsalt(self):
    """ generate a random DES salt two long """
    return self.DESsaltprefix + self.gen_random(self.valid_salt_set, 2)
    def gen_password(self, length):
    """ generate a random password string length long """
    return self.gen_random(self.valid_password_set, length)
    def cleartext(self):
    """ prompt for a password and return the string in clear text """
    return getpass.getpass()
    def encrypt(self, salt):
    """ prompt for a password and return the string encrypted using salt """
    _cleartext = self.cleartext()
    return crypt.crypt(_cleartext, salt)
    if __name__ == "__main__":
    # this will print a UNIX/Linux md5 encrypted password to screen
    md5salt = password().gen_MD5salt()
    encrypted_md5password = password().encrypt(md5salt)
    print encrypted_md5password

    I got bored and wrote a password module for python. Enjoy.
    #!/usr/bin/python
    # pypasswd.py
    # Written By: Tyler Gates
    import os, sys, crypt, string, getpass
    from random import choice
    class password:
    MD5saltprefix = "$1$"
    DESsaltprefix = ""
    valid_salt_set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/."
    valid_password_set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[]^_`{|}~\ "
    def gen_random(self, set, length):
    """ generate random string length long from set """
    random_string = ""
    for i in range(length):
    random_string = random_string + choice(set)
    return random_string
    def gen_MD5salt(self):
    """ generate a random MD5 salt eight long """
    return self.MD5saltprefix + self.gen_random(self.valid_salt_set, 8)
    def gen_DESsalt(self):
    """ generate a random DES salt two long """
    return self.DESsaltprefix + self.gen_random(self.valid_salt_set, 2)
    def gen_password(self, length):
    """ generate a random password string length long """
    return self.gen_random(self.valid_password_set, length)
    def cleartext(self):
    """ prompt for a password and return the string in clear text """
    return getpass.getpass()
    def encrypt(self, salt):
    """ prompt for a password and return the string encrypted using salt """
    _cleartext = self.cleartext()
    return crypt.crypt(_cleartext, salt)
    if __name__ == "__main__":
    # this will print a UNIX/Linux md5 encrypted password to screen
    md5salt = password().gen_MD5salt()
    encrypted_md5password = password().encrypt(md5salt)
    print encrypted_md5password

Maybe you are looking for

  • Getting error when rasing request in OIM using API

    Hi, I am getting the following error when I am trying to raise a request from outside OIM using OIM API's. Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/persistence/indirection/ValueHolderInterface      at accesspolicycreatio

  • Time Machine reports backup disc needs to be 8.78 Tb.  I only have a 250Gb system drive???

    Thought I'd do a TM backup before installing Mavericks.  It messed up big time! I backup manually depending on how much stuff has accumulated.  It varies between a few Mb to 3 or 4 Gb sometimes more.  Today Time Machine decided that it wanted to reor

  • Certified digital signature

    Does anyone know how I can assign a digital signature to a PDF document, a word or pages document or an email message using Snow leopard? Thanks OF

  • Installing maverics: mail-database will not update - it 'hangs'

    Just updated to mavericks all seems to work, except that Mail will not start: the database update process seems to hang. Is anything known about this? How can I re-start this process manually and re-import the mail data from my ccc backup? I am upgra

  • Grant select sequence to other users

    Hi all, Assume: I have a user "A" who have table name "test" and sequence name "test_seq". How can the user "B" able to select on the sequence "test_seq" of user A, by this command below: connect B/password SELECT test_seq.nextval from dual; Thanks,