LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-18-2011, 05:24 AM   #1
dolphs
Member
 
Registered: Nov 2003
Posts: 52

Rep: Reputation: 15
Read password from AES encryption from txt file


Hi,

I am fiddling around using an AES encrypted password which is stored in passwd.txt:

cat ../passwd/passwd.txt
{AES}yTMWTrdbuPtCxikvv5udVDTQ70anBVVKvP+GPQEH1RY=


Yet I like to interpret this password on the command line using svn checkout,
so I do not have to type in my password ( which is visible on the command line):

Exporting the variable SVNPASS reading it from the passwd.txt ( export SVNPASS=`cat <../passwd/passwd.txt`) won't work obviously as it interprets it as "text", so my question is, if there is a proper way to interpret this stored AES password so I can read it from the file?


The alternative is to type in the password on the command line, but this needs to be invisible eitehr showing #, * or "hidden".
the last option is described: http://www.tech-recipes.com/rx/278/h...-shell-script/

Last edited by dolphs; 01-18-2011 at 06:09 AM.
 
Old 01-18-2011, 02:22 PM   #2
KWTm
Member
 
Registered: Jan 2004
Distribution: Kubuntu 14.04 (Dell Linux-preinstalled laptop + 2 other laptops)
Posts: 117

Rep: Reputation: 21
how is "only text" a problem?

I would like to help you but am not familiar with "svn checkout"; do I need to be, in order to help you?

Please explain your question a bit ... how does exporting the variable SVNPASS cause it to interpret it as "text", and how is this not you want?

I presume that you would like the variable SVNPASS to contain the text
{AES}yTMWTrdbuPtCxikvv5udVDTQ70anBVVKvP+GPQEH1RY=
which is exactly what your command above should do: export SVNPASS=`cat <../passwd/passwd.txt`

There are several possibilities of what you mean:

If you did exactly the above but SVNPASS failed to contain the text above, it may be because use of the backticks ` is specific to bash and you're actually using a different shell (for example, Ubuntu Linux uses /bin/dash for script files but /bin/bash for interactive shells). You'd want to use the more correct notation with "$( )":

export SVNPASS=$(cat <../passwd/passwd.txt)

If you actually need the SVNPASS to contain the text *after* where it says "{AES}" --that is, you want to remove the first 5 characters from the string above and only contain yTMWTrdbuPtCxikvv5udVDTQ70anBVVKvP+GPQEH1RY= then there are several ways you can do this, such as

export SVNPASS=$(tail --bytes=+6 ../passwd/passwd.txt)

which uses the "tail" command to start from the 6th character of your file, or

export SVNPASS=$(sed -e 's/^{AES}//' ../passwd/passwd.txt)

which uses "sed" to remove any occurrence of "{AES}" at the start of the string.

Otherwise, please specify a bit more --exactly how does "svn checkout" use $SVNPASS?
 
Old 01-18-2011, 05:55 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Unfortunately, the svn package doesn't install manpages. You may need to provide more info. Installing the subversion-doc package, I can't find the string "SVNPASS".

I don't understand if you encrypted your password, or created a hash? A hash is a one way function, so you won't get the password back. If you encrypted your password, so you can save it in a file, you need a passphrase to decrypt it, so what is the point.

There are several types of aes encryption handled by openssl, so I don't know which you are using. Sometimes you can run into a problem if you included or excluded a newline.
 
Old 01-18-2011, 08:41 PM   #4
KWTm
Member
 
Registered: Jan 2004
Distribution: Kubuntu 14.04 (Dell Linux-preinstalled laptop + 2 other laptops)
Posts: 117

Rep: Reputation: 21
Agree with jschiwal; that was the other possible thing you meant. To clarify, it's possible that you mean this:

Suppose your password is aardvark, and SVN hashes your password and stores it as the string you gave above:
{AES}yTMWTrdbuPtCxikvv5udVDTQ70anBVVKvP+GPQEH1RY=

Are you trying to obtain the word "aardvark" from the long string above? It's not possible. The whole point of hashing the password is so that you can't obtain the original password again; you would need to know the original password in the first place.

If you actually encrypted your password (not hashed but encrypted) then you should already know how to decrypt the password. This would be the case if you used a program like "bcrypt" or "openssl enc". If you used "md5" or "crypt" then that's a one-way hash, not encryption. If that was the output from SVN, then it's likely a hash, not encryption.
 
Old 01-19-2011, 09:55 AM   #5
nomb
Member
 
Registered: Jan 2006
Distribution: Debian Testing
Posts: 675

Rep: Reputation: 58
That looks like a base64 encoded string to me. In which cause it wouldn't make much sense to base64 encode a hash. I am going to put my money on an AES encrypted string that is base64 encoded with '{AES}' pre-pended to it.
 
Old 01-19-2011, 04:10 PM   #6
KWTm
Member
 
Registered: Jan 2004
Distribution: Kubuntu 14.04 (Dell Linux-preinstalled laptop + 2 other laptops)
Posts: 117

Rep: Reputation: 21
If nomb is right, then some program has AES-encrypted a string. I wonder if it's SVN? But how would SVN decrypt the string? It would need to have a password --either typed in by the user, in which case why store the encrypted password in the first place?-- or already stored somewhere on file --in which case why not just store the original password?

Anyway, think we need more info before proceeding.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to read a txt file with C++ in linux and output it? azraelluz Programming 1 03-15-2010 08:12 PM
OpenSSL Encryption with AES kaplan71 Linux - Software 3 11-26-2008 12:46 PM
Read a txt file in C xeon123 Programming 3 10-21-2007 11:14 AM
How can read from file.txt C++ where can save this file(file.txt) to start reading sam_22 Programming 1 01-11-2007 05:11 PM
Need help with loop-aes encryption. yanik Linux - Software 0 04-20-2006 07:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration