@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
160 lines (159 loc) • 4.41 kB
TypeScript
/**
* Base cipher interface for internal cipher implementations.
*
* @private
*/
export declare abstract class _Cipher {
/**
* Decrypt a block of data.
*
* @private
* @param {Uint8Array} data - Data to decrypt.
* @param {boolean} [finalize] - Whether this is the final block.
* @param {Uint8Array} [iv] - Optional initialization vector.
* @returns {Uint8Array} Decrypted bytes.
*/
abstract _decryptBlock(data: Uint8Array, finalize?: boolean, iv?: Uint8Array): Uint8Array;
/**
* Encrypt a block of data.
*
* @private
* @param {Uint8Array} data - Data to encrypt.
* @returns {Uint8Array} Encrypted bytes.
*/
abstract _encrypt(data: Uint8Array): Uint8Array;
}
/**
* AES-like advanced encryption base used internally for PDF encryption ciphers.
*
* @private
*/
export declare abstract class _AdvancedEncryptionBaseCipher extends _Cipher {
/**
* Cached mix column lookup table.
*
* @private
*/
_mixC: Uint8Array;
/**
* Buffer used for partial block accumulation.
*
* @private
*/
_buffer: Uint8Array;
/**
* Current buffer write position.
*
* @private
*/
_position: number;
/**
* Key size in bytes used by this cipher instance.
*
* @private
*/
_keySize: number;
/**
* Number of cipher rounds.
*
* @private
*/
_cyclesOfRepetition: number;
/**
* Initialization vector for streaming operations.
*
* @private
*/
_iv: Uint8Array;
/**
* The expanded key schedule.
*
* @private
*/
_key: Uint8Array;
/**
* Length of data currently in the buffer.
*
* @private
*/
_bufferLength: number;
/**
* Substitution box used for byte substitution.
*
* @private
*/
_s: Uint8Array;
/**
* Inverse S-box used for decryption.
*
* @private
*/
_inverseS: Uint8Array;
/**
* Mix column table used in block transformations.
*
* @private
*/
_mix: Uint32Array;
/**
* Lazily-created mix column byte table.
*
* @private
* @returns {Uint8Array} The mix column table as a `Uint8Array`.
*/
readonly _mixCol: Uint8Array;
/**
* Expand a cipher key into the full key schedule.
*
* @private
* @param {Uint8Array} cipherKey - The raw cipher key bytes.
* @returns {Uint8Array} The expanded key schedule.
*/
abstract _expandKey(cipherKey: Uint8Array): Uint8Array;
/**
* Core single-block decryption routine.
*
* @private
* @param {Uint8Array} input - 16-byte input block.
* @param {Uint8Array} key - Expanded key schedule.
* @returns {Uint8Array} Decrypted 16-byte block.
*/
_decrypt(input: Uint8Array, key: Uint8Array): Uint8Array;
/**
* Core single-block encryption routine.
*
* @private
* @param {Uint8Array} input - 16-byte input block.
* @param {Uint8Array} key - Expanded key schedule.
* @returns {Uint8Array} Encrypted 16-byte block.
*/
_encryptBlock(input: Uint8Array, key: Uint8Array): Uint8Array;
/**
* Helper that decrypts a sequence of bytes using internal buffering.
*
* @private
* @param {Uint8Array} data - Input bytes to decrypt.
* @param {boolean} finalize - Whether to finalize (remove padding) for the last block.
* @returns {Uint8Array} Decrypted bytes.
*/
_decryptBlockHelper(data: Uint8Array, finalize: boolean): Uint8Array;
/**
* Public-facing decrypt block implementation that sets up IV and buffering.
*
* @private
* @param {Uint8Array} data - Input data to decrypt.
* @param {boolean} finalize - Whether this is the final call (remove padding).
* @param {Uint8Array} [iv] - Optional initialization vector for decryption.
* @returns {Uint8Array} Decrypted bytes.
*/
_decryptBlock(data: Uint8Array, finalize: boolean, iv?: Uint8Array): Uint8Array;
/**
* Encrypt data using streaming semantics and internal buffering.
*
* @private
* @param {Uint8Array} data - Bytes to encrypt.
* @param {Uint8Array} [iv] - Optional initialization vector.
* @returns {Uint8Array} Encrypted bytes.
*/
_encrypt(data: Uint8Array, iv?: Uint8Array): Uint8Array;
}