how to print encrypted string in this code ?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: how to print encrypted string in this code ?

  1. #1
    Join Date
    Mar 2006
    Posts
    12

    how to print encrypted string in this encrypting/decrypting code ?

    Hi all,
    here is full working code for encrypting and decrypting a string. It encrypts entered string and the decrypts it. It doesnt shows the encrypted string.

    http://www.java-tips.org/java-se-tip...tric-keys.html

    I just wanted to know how can i show enrypted string too.
    PLEASE HELP...!!!

    thanks,
    Last edited by bond_ankur; 04-07-2006 at 05:21 PM.

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    In your main, after you receive the encryptedBytes back from the encrypt() method, add

    System.out.println( new String(encryptedBytes) );

  3. #3
    Join Date
    Mar 2006
    Posts
    12
    Quote Originally Posted by nspils
    In your main, after you receive the encryptedBytes back from the encrypt() method, add

    System.out.println( new String(encryptedBytes) );

    Hi nspils,

    I tried this "System.out.println( new String(encryptionBytes));" in many places in main, BUT its not working, there is no change in output.
    AND it is enrcyptionBytes. If possible please tell me the exact line where to place it.
    PLEASE HELP ...!!!

    Thanks

  4. #4
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    You tried this where the bolded line is, and it did not print out?

    Code:
       
    public static void main(String[] args) throws Exception 
    {
        setUp();
        if (args.length !=1) 
       {
           System.out.println(
           "USAGE: java LocalEncrypter " + "[String]");
           System.exit(1);
       }
       byte[] encryptionBytes = null;
       String input = args[0];
       System.out.println("Entered: " + input);
       encryptionBytes = encrypt(input);
       System.out.println("Encrypted: " + (new String(encryptionBytes)));
       System.out.println("Recovered: " + decrypt(encryptionBytes));
    }

Similar Threads

  1. SQL DMO Restores in VB?
    By ObiWan in forum VB Classic
    Replies: 3
    Last Post: 05-23-2006, 11:35 AM
  2. Replies: 3
    Last Post: 10-03-2005, 12:57 AM
  3. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 04:53 AM
  4. Replies: 0
    Last Post: 06-22-2000, 08:30 AM
  5. Database problems
    By Robert Rieth in forum VB Classic
    Replies: 1
    Last Post: 04-11-2000, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center