Module jcifs

Class RC4

java.lang.Object
org.codelibs.jcifs.smb1.util.RC4

public class RC4 extends Object
Implementation of the RC4 (ARCFOUR) stream cipher algorithm. This class provides RC4 encryption/decryption functionality used in SMB1 protocol operations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RC4()
    Default constructor for RC4 cipher.
    RC4(byte[] key)
    Constructs and initializes an RC4 cipher with the specified key.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    init(byte[] key, int ki, int klen)
    Initializes the RC4 cipher with a key.
    void
    update(byte[] src, int soff, int slen, byte[] dst, int doff)
    Encrypts or decrypts data using the RC4 stream cipher.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RC4

      public RC4()
      Default constructor for RC4 cipher. Call init() to initialize with a key before use.
    • RC4

      public RC4(byte[] key)
      Constructs and initializes an RC4 cipher with the specified key.
      Parameters:
      key - the encryption key
  • Method Details

    • init

      public void init(byte[] key, int ki, int klen)
      Initializes the RC4 cipher with a key. This method sets up the RC4 state array using the key scheduling algorithm.
      Parameters:
      key - the key array
      ki - the starting offset in the key array
      klen - the length of the key to use
    • update

      public void update(byte[] src, int soff, int slen, byte[] dst, int doff)
      Encrypts or decrypts data using the RC4 stream cipher. Since RC4 is a stream cipher, the same operation is used for both encryption and decryption.
      Parameters:
      src - the source data array
      soff - the offset in the source array
      slen - the length of data to process
      dst - the destination array for the result
      doff - the offset in the destination array