• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How to encrypt a string &save it to a file??

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I want to encrypt a text & save it to file,which should not be human readable or easily understandable.In my application I want to read the file & decrypt the text.Please reply with some code if possible.
Happy middling with java.
Netharam.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Blowfish symmetric algorithm
It is opensource, better than DES, easy to use, fit your needs perfectly. Don't forget to acknowledge them!
Thanks!
Roseanne
Need Java real project experience? Join our project team here!
[ April 29, 2002: Message edited by: Roseanne Zhang ]
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RSA encryption
found on another forum.
Also,
  • Quick link to RSA
  • XML encryption, got the news froma Dutch guy working at ABN that IBM developped a Encryption / Decryption tool for XML (not free) which allows you to encode part of an XML file


  • Thomas,
     
    Roseanne Zhang
    Ranch Hand
    Posts: 1953
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by netharam ram:
    Hi, I want to encrypt a text & save it to file,which should not be human readable or easily understandable.In my application I want to read the file & decrypt the text.Please reply with some code if possible.


    From my understanding of the question, the encryption/decryption is done by the same party, correct me if I am wrong, symmetric algorithm is the way to go. Blowfish is a new and better symmetric encryption algorithm. DES is another one... I used Blowfish encryption, our product has just shipped to Disney.
    RSA is for encrypting by one party and decrypting by another party. RSA or other Public/Private Key pair system (e.g. D-H Public-Key Directory) solved the famous key transportation problem. Read a very good introductory from here: Introduction To Cryptography
    MD5 or other one-way digest encryption algorithm is for encrypting password, which means you never want to decrypt it back. I used it on our project team login page for a little more than a year now...
    Different encryption algorithms solve different problems and are used for different purposes...
    [ May 05, 2002: Message edited by: Roseanne Zhang ]
     
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by netharam ram:
    Hi, I want to encrypt a text & save it to file,which should not be human readable or easily understandable.In my application I want to read the file & decrypt the text.Please reply with some code if possible.
    Happy middling with java.
    Netharam.


    You can use JCE for any sort of encryption that you would like to perform. Look at the JCE documentaion in the appendicies for an example of PBE (password based encryption). That you get you started.
    charlie
     
    Charlie Hubbard
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Here is the URL for JCE
    http://java.sun.com/products/jce/
    If you're running JDK1.4 you don't need to download it.
    charlie
     
    Roseanne Zhang
    Ranch Hand
    Posts: 1953
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    JCE are just interfaces. Sun provider does not provide any Sysmmetric algorithms, only RSA and MD5 etc.. You still need the Encryption algorithm providers.
    Been there, and done that.
     
    Roseanne Zhang
    Ranch Hand
    Posts: 1953
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    If you download the BlowfishJ, and try their sample code, then you will find how easy to use it. We wasted so much time to discuss it, it is enough to get the job done already.
     
    Author
    Posts: 6055
    8
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Roseanne Zhang:
    JCE are just interfaces. Sun provider does not provide any Sysmmetric algorithms, only RSA and MD5 etc.. You still need the Encryption algorithm providers.
    Been there, and done that.



    Easy enough, just go to Cryptix or Bounce Castle for providers.
    --Mark
     
    Ranch Hand
    Posts: 213
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Roseanne Zhang:
    JCE are just interfaces. Sun provider does not provide any Sysmmetric algorithms, only RSA and MD5 etc.. You still need the Encryption algorithm providers.
    Been there, and done that.


    On the contrary, I think the Sun provider that ships with the JCE(assuming you are within the US) does provide implementations of the symmetric-key DES and BlowFish algorithms. It does not provide an implementation of the RSA algorithm though...
    [ May 01, 2002: Message edited by: Junaid Bhatra ]
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic