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.