Results 1 to 4 of 4

Thread: Java + SH

  1. #1
    mac's Avatar
    mac
    mac is offline Member
    Join Date
    Dec 2009
    Location
    St. Petersburg, Russia
    Posts
    81
    Rep Power
    0

    Default Java + SH

    I need a way to securely communicate password from my jar to a ksh script so that it can later refer to it as $1

    Passing it as a parameter is no good, as simple ps -wef | grep proc will show the password in clear text

    I was thinking about creating a random String, and exporting it as {randomString}={realpassword} format, where {randomString} is passed to the SH script, but it seems Java's setProperty method is limited to JVM and does not extend to the outside world.

    Can you make a suggestion on how to best approach this?

    The task is not to write a program for Nasa, but to make sure that it at least fool proof and simple things like ps won't catch password shown in clear text

    Thanks

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,574
    Rep Power
    25

    Default

    Yes, you could write a simple encrypt method in Java and pass it to a script that is capable of decrypting it. How secure do you want it? If the script can be read by a programmer, it could be cut and pasted to output the password in the clear.

    Sorry I really have no idea what a ksh script is.

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    There's really no way to do this securely. Can you take a step back and give us a look at the bigger picture? What is it you're trying to do?

    -Gary-

  4. #4
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    And to answer your question more directly, probably the best work-around you can manage is to write to a file, and have your ksh script read from it.

    -Gary-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •