UNPKG

@syncfusion/ej2-pdf

Version:

Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.

167 lines (166 loc) 4.36 kB
import { _Cipher } from './cipher'; /** * Simple stream cipher implementation (variant used internally). * * @private */ export declare class _NormalCipherFour extends _Cipher { /** * Internal pointer A. * * @private */ _a: number; /** * Internal pointer B. * * @private */ _b: number; /** * Permutation table for the stream cipher. * * @private */ _s: Uint8Array; constructor(key: Uint8Array); /** * Encrypt/decrypt a byte array block using the stream cipher state. * * @private * @param {Uint8Array} data - Input bytes to process. * @returns {Uint8Array} The processed bytes. */ _encryptBlock(data: Uint8Array): Uint8Array; /** * Decrypt a block. * * @private * @param {Uint8Array} data - Input bytes. * @returns {Uint8Array} The processed bytes. */ _decryptBlock(data: Uint8Array): Uint8Array; /** * Encrypt data. * * @private * @param {Uint8Array} data - Input bytes. * @returns {Uint8Array} Encrypted bytes. */ _encrypt(data: Uint8Array): Uint8Array; } /** * No-op cipher used when encryption is disabled. * * @private */ export declare class _NullCipher extends _Cipher { /** * Return input data unchanged. * * @private * @param {Uint8Array} data - Input bytes. * @returns {Uint8Array} The same bytes (unchanged). */ _decryptBlock(data: Uint8Array): Uint8Array; /** * Return input data unchanged. * * @private * @param {Uint8Array} data - Input bytes. * @returns {Uint8Array} The same bytes (unchanged). */ _encrypt(data: Uint8Array): Uint8Array; } /** * RC2-style block cipher wrapper used internally. * * @private */ export declare class _CipherTwo extends _Cipher { /** * Raw key bytes. * * @private */ _key: Uint8Array; /** * Cipher block size in bytes. * * @private */ _blockSize: number; /** * Effective key size in bits. * * @private */ _effectiveKeyBits: number; /** * Expanded key schedule used by RC2. * * @private */ _expandedKey: Uint16Array; constructor(key: Uint8Array, effectiveKeyBits?: number); /** * Expand the provided key into the internal RC2 key schedule. * * @private * @param {Uint8Array} key - Key bytes. * @param {number} bits - Effective key size in bits. * @returns {Uint16Array} Expanded key schedule as `Uint16Array`. */ _expandKey(key: Uint8Array, bits: number): Uint16Array; /** * Rotate a 16-bit value left by `n` bits. * * @private * @param {number} x - The 16 bit value. * @param {number} n - Number of bits to rotate. * @returns {number} The rotated 16 bit value. */ _rotateLeft(x: number, n: number): number; /** * Rotate a 16-bit value right by `n` bits. * * @private * @param {number} x - The 16 bit value. * @param {number} n - Number of bits to rotate by. * @returns {number} The rotated 16 bit value. */ _rotateRight(x: number, n: number): number; /** * Encrypt a single RC2 block. * * @private * @param {Uint8Array} block - 8 byte block to encrypt. * @returns {Uint8Array} Encrypted 8-byte block. */ _encryptBlock(block: Uint8Array): Uint8Array; /** * Decrypt a single RC2 block. * * @private * @param {Uint8Array} block - 8-byte block to decrypt. * @returns {Uint8Array} Decrypted 8-byte block. */ _decryptBlock(block: Uint8Array): Uint8Array; /** * Encrypt arbitrary data (pads to block size) and returns encrypted bytes. * * @private * @param {Uint8Array} data - Bytes to encrypt. * @returns {Uint8Array} Encrypted bytes. */ _encrypt(data: Uint8Array): Uint8Array; /** * Decrypt data using CBC-like chaining with the provided IV. * * @private * @param {Uint8Array} data - Encrypted bytes. * @param {Uint8Array} [iv] - Initialization vector; must be `blockSize` bytes if provided. * @returns {Uint8Array} Decrypted bytes (padding may be removed if valid). */ _decrypt(data: Uint8Array, iv?: Uint8Array): Uint8Array; }