BlockCipher.d.ts
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Cipher, CipherProps, PropsWithKey } from "./Cipher";
import type { BlockCipherMode, BlockCipherModeProps } from "./mode/BlockCipherMode";
import type { Pad } from "./pad/type";
import type { Word32Array } from "../../Word32Array";
import type { BaseKDFModule } from "./kdf/type";
import type { Hasher } from "../Hasher";
export interface BlockCipherProps extends CipherProps {
mode: typeof BlockCipherMode;
padding: Pad;
kdfSalt: Word32Array;
kdfModule: typeof BaseKDFModule;
kdfHasher: typeof Hasher;
kdfIterations: number;
}
export declare class BlockCipher extends Cipher {
protected _props: PropsWithKey<BlockCipherProps>;
protected _blockSize: number;
protected _Mode: typeof BlockCipherMode;
protected _mode?: BlockCipherMode;
protected _padding: Pad;
protected _modeCreator?: (props: BlockCipherModeProps) => BlockCipherMode;
/**
* @see https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-337560146
*/
["constructor"]: typeof BlockCipher;
constructor(props: PropsWithKey<BlockCipherProps>);
get mode(): BlockCipherMode | undefined;
get padding(): Pad;
reset(data?: Word32Array, nBytes?: number): void;
protected _doProcessBlock(words: number[], offset: number): void;
protected _doFinalize(): Word32Array;
/**
* @abstract
*/
encryptBlock(words: number[], offset: number): void;
/**
* @abstract
*/
decryptBlock(words: number[], offset: number): void;
/**
* Creates this cipher in encryption mode.
*
* @param {Word32Array} key The key.
* @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
* @return {Cipher} A cipher instance.
* @example
* var cipher = AES.createEncryptor(keyWordArray, { iv: ivWordArray });
*/
static createEncryptor(key: Word32Array, props?: Partial<BlockCipherProps>): BlockCipher;
/**
* Creates this cipher in decryption mode.
* @param {Word32Array} key The key.
* @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
* @return {Cipher} A cipher instance.
* @example
* var cipher = AES.createDecryptor(keyWordArray, { iv: ivWordArray });
*/
static createDecryptor(key: Word32Array, props?: Partial<BlockCipherProps>): BlockCipher;
}