• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Using a custom string to generate a key. (Or part of a key)

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there.

I want to use JCE for my encryption in my java program.

I was wondering if it's possible and how to use a custom string such as the hard drive serial number in my key. So that I that I can have a different key for each client that uses my program and so have my updates using a different key for each user. And so it may only be used on that machine and no other.

I haven't worked out how to get the hard drive serial number yet but I know that is a different subject all together using JNI.

I just need to know how to implement that string into the encryption. would I be able to make it part of the key, or am i going about it all wrong???

Thanks in advance.
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The usual way is to use the password-based encryption (PBE) ciphers. You would treat the serial number as a "password" for the purposes of understanding the parameters to PBE algorithms. Have a look at http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#PBEEx for an example. Also look at http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html to see what PBE algorithms are supported by the Sun parameters. Other providers, e.g the bouncycastle provider, may support more or different algorithms.
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks.
will have a look at it...
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Greg. was just what I needed.

Only problem I'm getting now is with the Decryption. It Decrypts most the information fine but I see there are small sections here and there that are not decrypted properly. Is there a common reason for this that I can look for?
I'm very new to this stuff so forgive me if I seem to not know exactly what I'm doing.
Thanks again.
 
greg stark
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, but without seeing your code I can only make guesses. Perhaps you are trying to use the Java String class as a container for the ciphertext? This is a common mistake.
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think that is what the problem was.
Got it sorted out now though.
Thanks for the help Greg.
reply
    Bookmark Topic Watch Topic
  • New Topic