Name

Cipher

Synopsis

Classes that implement this interface are used to encrypt or decrypt data. Instances of the Cipher class are obtained from the platform’s JXTA crypto suite; the standard Java implementation provides a Cipher class that is capable of performing RC4 encryption.

To use a Cipher object, you must initialize it with the appropriate secret key (usually obtained from the jxta.security.impl.KeyBuilder class) and the mode you want to perform (encryption or decryption). You then pass the data to be encrypted (or decrypted) to the update( ) method, which can be called any number of times with the appropriate data. The last set of data must be passed to the doFinal( ) method.

public interface Cipher extends jxta.security.util.Description {
// Public Constants
   public static final byte ALG_RC4;                            
// =4
   public static final String Ciper;                            
// ="CIPHER”
   public static final byte MODE_DECRYPT;                       
// =2
   public static final byte MODE_ENCRYPT;                       
// =1
   public static final byte MODE_UNKNOWN;                       
// =99
                  // Public Instance Methods
   public abstract int doFinal(byte[ ] inBuff, int inOffset, int inLength, byte[ ] outBuff, int outOffset) 
       throws jxta.security.exceptions.CryptoException;
   public abstract byte getAlgorithm();  
   public abstract void init(jxta.security.cipher.Key theKey, byte theMode) throws jxta.security.exceptions.CryptoException; 
   public abstract void init(jxta.security.cipher.Key theKey, byte theMode, byte[ ] bArray, int bOff, int bLen) throws jxta.security.exceptions.CryptoException; public ...

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.