2018-05-07 15:00:49 +02:00
|
|
|
import { DecryptParameters } from '../models/domain/decryptParameters';
|
|
|
|
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
|
|
|
|
2018-04-15 05:20:37 +02:00
|
|
|
export abstract class CryptoFunctionService {
|
2018-04-16 18:07:51 +02:00
|
|
|
pbkdf2: (password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512',
|
2018-04-18 03:18:47 +02:00
|
|
|
iterations: number) => Promise<ArrayBuffer>;
|
2020-10-29 20:52:12 +01:00
|
|
|
hkdf: (ikm: ArrayBuffer, salt: string | ArrayBuffer, info: string | ArrayBuffer,
|
|
|
|
outputByteSize: number, algorithm: 'sha256' | 'sha512') => Promise<ArrayBuffer>
|
|
|
|
hkdfExpand: (prk: ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number,
|
|
|
|
algorithm: 'sha256' | 'sha512') => Promise<ArrayBuffer>;
|
2018-07-31 05:29:30 +02:00
|
|
|
hash: (value: string | ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512' | 'md5') => Promise<ArrayBuffer>;
|
2018-04-18 01:02:58 +02:00
|
|
|
hmac: (value: ArrayBuffer, key: ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512') => Promise<ArrayBuffer>;
|
2018-05-07 18:14:40 +02:00
|
|
|
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
2018-05-07 15:00:49 +02:00
|
|
|
hmacFast: (value: ArrayBuffer | string, key: ArrayBuffer | string, algorithm: 'sha1' | 'sha256' | 'sha512') =>
|
|
|
|
Promise<ArrayBuffer | string>;
|
2018-05-07 18:14:40 +02:00
|
|
|
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
2018-04-22 05:14:04 +02:00
|
|
|
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
2018-05-07 15:00:49 +02:00
|
|
|
aesDecryptFastParameters: (data: string, iv: string, mac: string, key: SymmetricCryptoKey) =>
|
|
|
|
DecryptParameters<ArrayBuffer | string>;
|
|
|
|
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
2018-05-07 18:14:40 +02:00
|
|
|
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
2018-04-22 05:14:04 +02:00
|
|
|
rsaEncrypt: (data: ArrayBuffer, publicKey: ArrayBuffer, algorithm: 'sha1' | 'sha256') => Promise<ArrayBuffer>;
|
2018-07-03 05:53:44 +02:00
|
|
|
rsaDecrypt: (data: ArrayBuffer, privateKey: ArrayBuffer, algorithm: 'sha1' | 'sha256') => Promise<ArrayBuffer>;
|
|
|
|
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
2018-07-03 17:41:55 +02:00
|
|
|
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
2018-04-22 05:14:04 +02:00
|
|
|
randomBytes: (length: number) => Promise<ArrayBuffer>;
|
2018-04-15 05:20:37 +02:00
|
|
|
}
|