May 2001
Intermediate to advanced
1088 pages
30h 13m
English
The JCE represents keys two different ways. First, there is a class called SecretKey that is an opaque version of the key. That is, although the SecretKey class represents a key, you don't have access to the individual bits in the key. The other representation is called a key specification. A key specification, or key spec, is represented by the SecretKeySpec class and by algorithm-specific subclasses such as DESKeySpec or PBEKeySpec.
The easiest way to generate a random key is just to use a KeyGenerator class. Use the getInstance method to get a key generator for the particular algorithm you want to use. For example, to generate a random key for DESede, you first call
KeyGenerator keyGen = KeyGenerator.getInstance("DESede"); ...Read now
Unlock full access