@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
176 lines (175 loc) • 4.64 kB
TypeScript
import { _PdfBaseStream } from '../../base-stream';
import { _PdfDecryptStream } from '../../decrypt-stream';
import { _Cipher } from './cipher';
/**
* Helper that binds string and stream cipher implementations for internal use.
*
* @private
*/
export declare class _CipherTransform {
/**
* Cipher used for strings.
*
* @private
*/
_stringCipher: _Cipher;
/**
* Cipher used for streams.
*
* @private
*/
_streamCipher: _Cipher;
constructor(stringCipher: _Cipher, streamCipher: _Cipher);
/**
* Create a decrypting stream wrapper using the configured stream cipher.
*
* @private
* @param {_PdfBaseStream} stream - The source PDF stream.
* @param {number} length - The length of the stream in bytes.
* @returns {_PdfDecryptStream} A `_PdfDecryptStream` instance that decrypts on read.
*/
createStream(stream: _PdfBaseStream, length: number): _PdfDecryptStream;
/**
* Decrypt a PDF string using the configured string cipher.
*
* @private
* @param {string} s - The encoded string to decrypt.
* @returns {string} The decrypted string.
*/
decryptString(s: string): string;
/**
* Encrypt a string using the configured string cipher.
*
* @private
* @param {string} s - The plaintext string to encrypt.
* @returns {string} The encrypted string as PDF bytes.
*/
encryptString(s: string): string;
}
/**
* Data Encryption Standard (DES) implementation used internally.
*
* @private
*/
export declare class _DataEncryptionStandardCipher {
readonly blockSize: number;
/**
* Bit masks for byte-to-bit conversions.
*
* @private
*/
_byteBit: number[];
/**
* Large-byte lookup table used in key schedule generation.
*
* @private
*/
_bigByte: number[];
/**
* DES S-box 1 table.
*
* @private
*/
_sp1: number[];
/**
* DES S-box 2 table.
*
* @private
*/
_sp2: number[];
/**
* DES S-box 3 table.
*
* @private
*/
_sp3: number[];
/**
* DES S-box 4 table.
*
* @private
*/
_sp4: number[];
/**
* DES S-box 5 table.
*
* @private
*/
_sp5: number[];
/**
* DES S-box 6 table.
*
* @private
*/
_sp6: number[];
/**
* DES S-box 7 table.
*
* @private
*/
_sp7: number[];
/**
* DES S-box 8 table.
*
* @private
*/
_sp8: number[];
/**
* DES PC-1 table for key permutation.
*
* @private
*/
_pc1: number[];
/**
* Rotation schedule used when generating round keys.
*
* @private
*/
_rotationTable: number[];
/**
* DES PC-2 table for key compression.
*
* @private
*/
_pc2: number[];
private _keys;
constructor(key: Uint8Array, isEncrypt?: boolean);
/**
* Read a big-endian unsigned 32-bit integer from a byte array.
*
* @private
* @param {Uint8Array} b - Source byte array.
* @param {number} offset - Byte offset to read from.
* @returns {number} The 32-bit unsigned integer value.
*/
_beToUint32(b: Uint8Array, offset: 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} offset - Byte offset to write to.
* @returns {void}
*/
_uint32ToBe(v: number, b: Uint8Array, offset: 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} bytes - The 8-byte key material.
* @returns {number[]} An array of 32 integers representing round subkeys.
*/
_generateWorkingKey(isEncrypt: boolean, bytes: Uint8Array): number[];
/**
* Process a single 8-byte DES block, producing the output block.
*
* @private
* @param {Uint8Array} input - Source byte array containing the block.
* @param {number} inputOffset - Offset into `input` where the block starts.
* @param {Uint8Array} output - Destination byte array for the processed block.
* @param {number} outputOffset - Offset into `output` to write the block.
* @returns {void}
*/
_processBlock(input: Uint8Array, inputOffset: number, output: Uint8Array, outputOffset: number): void;
}