Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / April 2004

Tip: Looking for answers? Try searching our database.

How limit character set in encrypt (PBEKeySpec)

Thread view: 
Animanera - 17 Apr 2004 12:12 GMT
Is there a way to cypher a text limiting the characters that algorithm
can produce? (I've to limit them to alphanumeric characters, lowercase
and uppercase and not others).

On javaalmanac I've founded this example:
http://www.javaalmanac.com/egs/javax.crypto/PassKey.html

but I can't understand where put this setting.

Thanks in advance.
Bye to all, Animanera.
nobody - 18 Apr 2004 11:17 GMT
> Is there a way to cypher a text limiting the characters that algorithm
> can produce? (I've to limit them to alphanumeric characters, lowercase
[quoted text clipped - 4 lines]
>
> but I can't understand where put this setting.

To clarify the question; are you looking for the ciphertext to be from
the alphanumeric set?  Or you need to use an alphanumeric key?  The
example demonstrates the latter; I suspect you're really looking for the
former.

To convert a arbitrary binary ciphertext to a printable character set,
you would want to apply an encoding scheme.  Typically base64 is used
(although there are a few characters outsize [a-zA-Z0-9]).  You can also
encode the output in hexadecimal (zero through nine, and 'a' through 'f').

There's further explanation and example code for both at Roedy's site:

http://mindprod.com/jgloss/base64.html
http://mindprod.com/jgloss/hex.html
Roedy Green - 18 Apr 2004 20:21 GMT
>Is there a way to cypher a text limiting the characters that algorithm
>can produce? (I've to limit them to alphanumeric characters, lowercase
>and uppercase and not others).

That process is called "armouring".  Often all you have to do is
request it with a boolean on some encryption method.  If binary byte[]
output is all that is provided, you can use base64, the most common
way of making binary printable.  See
http://mindprod.com/jgloss/base64.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.