Re: How to generate remember-me encryptionKey and validationKey

Christopher Schultz <chris-Nf+wZpSdgwfUvtVhod0YCwZWvwf/[email protected]> Tue, 23 Oct 2007 13:54:18 -0400
Newsgroups gmane.comp.java.securityfilter.user
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============0556472005==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig111658121563A6C857B79E48"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig111658121563A6C857B79E48
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Warner,

This might be a little late, but...

> I would like to know how I create custom keys for my
> application. Obviously using the default keys provided in
> the example is not secure, however I cannot find any
> documentation or mailing list topics with instructions on
> how to generate encryptionKey and validationKeys.

Generating an encryption key is pretty easy:

	String algorithm =3D "AES"; // for example
	int keySize      =3D 128;   // for example

	KeyGenerator kg =3D KeyGenerator.getInstance(algorithm);

	kg.init(keySize);

	Key key =3D kg.generateKey();

	byte[] keybytes =3D key.getEncoded();

	// now convert the key to character-encoded bytes

Hope that helps,
-chris



--------------enig111658121563A6C857B79E48
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHjVK9CaO5/Lv0PARAiBzAJ0Yy+43ea3yVg3P190EEo2fH+PV7ACgwNdO
Q2qhveil1QOqFVeT9OKFztU=
=Gzz3
-----END PGP SIGNATURE-----

--------------enig111658121563A6C857B79E48--


--===============0556472005==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--===============0556472005==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
securityfilter-user mailing list
securityfilter-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/securityfilter-user

--===============0556472005==--