CipherParams.d.ts
2.3 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 type { Word32Array } from "../../Word32Array";
import type { BlockCipherMode } from "./mode/BlockCipherMode";
import type { Pad } from "./pad/type";
import type { Formatter } from "./formatter/type";
import type { Cipher } from "./Cipher";
/**
* A collection of cipher parameters.
*
* @property {Word32Array} ciphertext The raw ciphertext.
* @property {Word32Array} key The key to this ciphertext.
* @property {Word32Array} iv The IV used in the ciphering operation.
* @property {Word32Array} salt The salt used with a key derivation function.
* @property {typeof Cipher} algorithm The cipher algorithm.
* @property {BlockCipherMode} mode The block mode used in the ciphering operation.
* @property {Pad} padding The padding scheme used in the ciphering operation.
* @property {number} blockSize The block size of the cipher.
* @property {Formatter} formatter The default formatting strategy to convert this cipher params object to a string.
*/
export declare class CipherParams {
cipherText?: Word32Array;
key?: Word32Array;
iv?: Word32Array;
salt?: Word32Array;
Algorithm?: typeof Cipher;
mode?: BlockCipherMode;
padding?: Pad;
blockSize?: number;
formatter: Formatter;
/**
* Initializes a newly created cipher params object.
*
* @param {Partial<CipherParams>} cp An object with any of the possible cipher parameters.
* @example
* var cipherParams = new CipherParams({
* ciphertext: ciphertextWordArray,
* key: keyWordArray,
* iv: ivWordArray,
* salt: saltWordArray,
* algorithm: AES,
* mode: CBC,
* padding: PKCS7,
* blockSize: 4,
* formatter: OpenSSLFormatter
* });
*/
constructor(cp?: Partial<CipherParams>);
/**
* Converts this cipher params object to a string.
*
* @param {Formatter?} formatter (Optional) The formatting strategy to use.
* @return {string} The stringified cipher params.
* @throws Error If neither the formatter nor the default formatter is set.
* @example
* var string = cipherParams + '';
* var string = cipherParams.toString();
* var string = cipherParams.toString(OpenSSLFormatter);
*/
toString(formatter?: Formatter): string;
}