UNPKG

@syncfusion/ej2-pdf

Version:

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

125 lines (124 loc) 3.48 kB
/** * Triple DES implementation used internally for PDF encryption. * * @private */ export declare class _TripleDataEncryptionStandardCipher { /** * Block size in bytes (DES block size). * * @private */ readonly _blockSize: number; private _key1; private _key2; private _key3; private _isEncryption; /** * S-box 1 table. * * @private */ _sp1: number[]; /** * S-box 2 table. * * @private */ _sp2: number[]; /** * S-box 3 table. * * @private */ _sp3: number[]; /** * S-box 4 table. * * @private */ _sp4: number[]; /** * S-box 5 table. * * @private */ _sp5: number[]; /** * S-box 6 table. * * @private */ _sp6: number[]; /** * S-box 7 table. * * @private */ _sp7: number[]; /** * S-box 8 table. * * @private */ _sp8: number[]; /** * Create a Triple DES cipher instance with the given key. * * @private * @param {Uint8Array} key - The 16- or 24-byte Triple DES key. * @param {boolean} isEncryption - Whether the cipher will be used for encryption. */ constructor(key: Uint8Array, isEncryption?: boolean); /** * Read a big-endian unsigned 32-bit integer from a byte array. * * @private * @param {Uint8Array} b - Source byte array. * @param {number} off - Byte offset to read from. * @returns {number} The 32-bit unsigned integer value. */ _beToUint32(b: Uint8Array, off: number): number; /** * Write a 32-bit unsigned integer to a byte array in big-endian order. * * @private * @param {number} v - Value to write. * @param {Uint8Array} b - Destination byte array. * @param {number} off - Byte offset to write to. * @returns {void} */ _uint32ToBe(v: number, b: Uint8Array, off: number): void; /** * Generate the DES round keys (working key) from the provided key bytes. * * @private * @param {boolean} isEncrypt - Whether the keys are for encryption (true) or decryption (false). * @param {Uint8Array} keyBytes - The 8-byte key material. * @returns {Int32Array} An `Int32Array` representing round subkeys. */ _generateWorkingKey(isEncrypt: boolean, keyBytes: Uint8Array): Int32Array; /** * Process a single DES round using the supplied subkeys. * * @private * @param {Int32Array} keys - Round subkeys to use. * @param {Uint8Array} inBytes - Input byte array. * @param {number} inOffset - Offset into input array. * @param {Uint8Array} outBytes - Output byte array. * @param {number} outOffset - Offset into output array. * @returns {void} */ _processEncryptionBlock(keys: Int32Array, inBytes: Uint8Array, inOffset: number, outBytes: Uint8Array, outOffset: number): void; /** * Process a Triple DES block. * * @private * @param {Uint8Array} input - Input bytes containing the block. * @param {number} inOffset - Offset into `input` where the block starts. * @param {Uint8Array} output - Destination byte array. * @param {number} outOffset - Offset into `output` to write the block. * @returns {number} The block size in bytes. */ _processBlock(input: Uint8Array, inOffset: number, output: Uint8Array, outOffset: number): number; }