Re: read password from console

2012-02-08 Thread Stanley Cai
Thanks David and Kevin,

I tried System.console() in the code. The mystery is it could work in
clojure repl, but System.console() will return null if I put everything
into jar package. Per the spec, system.console could return null. I don't
quite understand why the two cases are different.

Best regards,
-stanley

On Tue, Feb 7, 2012 at 10:16 PM, David Powell djpow...@djpowell.net wrote:


 If you have Java 6 (and you probably do), then look at:

 http://docs.oracle.com/javase/6/docs/api/java/io/Console.htmlhttp://docs.oracle.com/javase/6/docs/api/java/io/Console.html#readPassword%28java.lang.String,%20java.lang.Object...%29

 Simple example:

   (String/valueOf (.readPassword (System/console) Password: nil))

 --
 Dave

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

read password from console

2012-02-07 Thread Stanley Cai
Hi,

When I wrote a utility in clojure, I found I cannot find a way to read
password from console. I use read-line for username, but would like not to
print the password on the console when reading password. Any hints?

Thanks,
-stanley

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: read password from console

2012-02-07 Thread Kevin Ilchmann Jørgensen
I truly hope you find something better than:
http://java.sun.com/developer/technicalArticles/Security/pwordmask/

One - not so portable way,  would be sending an \033]8m - invisible
char to the console beforehand ?

/Kevin



On Tue, Feb 7, 2012 at 10:26 AM, Stanley Cai stanley.w@gmail.com wrote:
 Hi,

 When I wrote a utility in clojure, I found I cannot find a way to read
 password from console. I use read-line for username, but would like not to
 print the password on the console when reading password. Any hints?

 Thanks,
 -stanley

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: read password from console

2012-02-07 Thread David Powell
If you have Java 6 (and you probably do), then look at:

http://docs.oracle.com/javase/6/docs/api/java/io/Console.htmlhttp://docs.oracle.com/javase/6/docs/api/java/io/Console.html#readPassword(java.lang.String,
java.lang.Object...)

Simple example:

  (String/valueOf (.readPassword (System/console) Password: nil))

-- 
Dave

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en