UNPKG

@syncfusion/ej2-pdf

Version:

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

110 lines (109 loc) 4.12 kB
import { _PdfNativeAlgorithmIdentifier } from './pdf-accumulator'; import { _ISigner } from './pdf-interfaces'; /** * Provides an internal RSA‑based message‑digest signer that computes a hash, * DER‑encodes the DigestInfo, and produces an RSA signature using PKCS#1 padding. * * @private */ export declare class _PdfRmdSigner implements _ISigner { private _digest; private _output; private _input; private _isSigning; private _ronCipherEngine; private _id; private _map; /** * Contains the requested digest algorithm name (e.g., "sha256"). * * @private */ _algorithmName: string; constructor(digest: string); private _getMap; /** * Populates the internal digest‑to‑OID map. * * @private * @returns {void} This method does not return a value. */ _initializeMap(): void; /** * Selects and returns the internal digest implementation for the given algorithm name. * * @private * @param {string} digest The requested digest algorithm (e.g., "sha256"). * @returns {any} The digest implementation instance corresponding to the algorithm. */ _getDigest(digest: string): any; /** * Resolves the AlgorithmIdentifier for the given digest by looking up its OID. * * @private * @param {string} digest The requested digest algorithm (normalized case-insensitive). * @returns {_PdfNativeAlgorithmIdentifier} The AlgorithmIdentifier for the digest. * @throws {Error} If the digest is unsupported. */ _getAlgorithmIdentifier(digest: string): _PdfNativeAlgorithmIdentifier; /** * Initializes the signer for signing or verification and prepares the RSA engine. * * @private * @param {boolean} isSigning Specifies whether to initialize for signature generation (true) or verification (false). * @param {any} parameters The RSA key parameters to use. * @returns {void} This method does not return a value. * @throws {Error} If a private key is missing for signing, or a public key is expected for verification. */ _initialize(isSigning: boolean, parameters: any): void; /** * Feeds a segment of bytes into the ongoing digest computation. * * @private * @param {Uint8Array} input The source buffer containing data. * @param {number} inOff The start index within the buffer. * @param {number} length The number of bytes to read. * @returns {void} This method does not return a value. */ _blockUpdate(input: Uint8Array, inOff: number, length: number): void; /** * Finalizes the digest, DER‑encodes the DigestInfo, and produces the RSA signature. * * @private * @returns {Uint8Array | null} The generated signature, or null if no hash output is available. * @throws {Error} If the signer is not initialized for signing. */ _generateSignature(): Uint8Array | null; /** * Builds the DER‑encoded DigestInfo structure for the given hash value. * * @private * @param {Uint8Array} hash The raw digest bytes to wrap in DigestInfo. * @returns {Uint8Array} The DER‑encoded DigestInfo; may return the hash directly if no identifier is set. */ _derEncode(hash: Uint8Array): Uint8Array; /** * Resets the internal accumulators and restarts chunked hashing. * * @private * @returns {void} This method does not return a value. */ _reset(): void; /** * Updates the digest with a single byte value. * * @private * @param {number} input The byte value to add. * @returns {void} This method does not return a value. */ _update(input: number): void; /** * Compares two byte arrays in constant order to determine equality. * * @private * @param {Uint8Array} a The first byte array. * @param {Uint8Array} b The second byte array. * @returns {boolean} True if the arrays are equal in length and content; otherwise, false. */ _compareArrays(a: Uint8Array, b: Uint8Array): boolean; }