Name
SecretKey
Synopsis
This class implements a secret key (that
is, one used for DES or RC4 encryption, though the standard package
supports only RC4 keys). Secret keys are obtained through the
KeyBuilder
class; once such a key is obtained, you
must initialize it by passing a random set of bytes to the
setKey( )
method. The random bytes should be
generated by a secure random number generator, such as the
JRandom
class. The length of the array of a random
byte should be KeyBuilder.LENGTH_RC4
. Because you
are required to perform this initialization, this class is commonly
used.
public final class SecretKey implements jxta.security.cipher.Key { // Public Constructors public SecretKey(byte type, short len); // Public Instance Methods public byte getKey(byte[ ] buf, int off); public void setKey(byte[ ] buf, int off) throws jxta.security.exceptions.CryptoException; // Methods Implementing Key public void clearKey(); public int getLength(); public short getSize(); public byte getType(); public boolean isInitialized(); }
Get JXTA in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.