@nebulae/angular-ble
Version:
A Web Bluetooth (Bluetooth Low Energy) module for angular (v2+)
89 lines (88 loc) • 3.28 kB
TypeScript
export declare class CypherAesService {
private masterKey;
private initialVector;
private encryptMethod;
private isStaticInitialVector;
private enctrypMethodInstance;
private isConfigExecuted;
private additionalEncryptMethodParams;
constructor();
/**
* Initial config used to initalice all required params
* @param masterKey key used to encrypt and decrypt
* @param initialVector vector used to encrypt abd decrypt except when ECB encrypt method is used
* @param encryptMethod type of encrypt method is used, the possible options are: CBC, CTR, CFB, OFB, ECB
* @param additionalEncryptMethodParams configuration params used by the selected encrypt method.
* Note: if the method CTR or CFB is used this param is required otherwise is an optinal param.
* By CTR require the param counter and by CFB require the param segmentSize
* @param isStaticInitialVector defines if the initial vector is changed or not when the data are encrypted or not
*/
config(masterKey: any, initialVector?: number[], encryptMethod?: string, additionalEncryptMethodParams?: {}, isStaticInitialVector?: boolean): void;
/**
* Encrypt the data using the encrypt method previously configured
* @param dataArrayBuffer data to encrypt
*/
encrypt(dataArrayBuffer: Uint8Array | Uint16Array | Uint32Array): any;
/**
* Decrypt the data using the encrypt method previously configured
* @param dataArrayBuffer data to decrypt
*/
decrypt(dataArrayBuffer: Uint8Array | Uint16Array | Uint32Array): any;
/**
* Change the current initalVector
* @param initialVector new initalVector
*/
changeInitialVector(initialVector: any): void;
/**
* Change the current encyptMethod
* @param encryptMethod new encryptMethod
*/
changeEncryptMethod(encryptMethod: any): void;
/**
* Change the current isStaticInitialVector
* @param isStaticInitialVector new isStaticInitalVector
*/
changeStaticInitialVector(isStaticInitialVector: any): void;
/**
* Change the current masterKey
* @param masterKey new masterKey
*/
changeMasterKey(masterKey: any): void;
/**
* Add padding to the list
*/
private addPadding(arrayBuffer);
/**
* generate a instance of the encrypt method using the current method configured
*/
private generateEncryptMethodInstance();
/**
* Convert the text to bytes
* @param text Text to convert
*/
textToBytes(text: any): any;
/**
* Convert the bytes to text
* @param bytes Bytes to convert
*/
bytesToText(bytes: Uint8Array | Uint16Array | Uint32Array): any;
/**
* Convert the bytes to hex
* @param bytes bytes to convert
*/
bytesTohex(bytes: any): any;
/**
* Convert the hex to bytes
* @param hex Hex to convert
*/
hexToBytes(hex: any): any;
generateSubkeys(key: any): {
subkey1: any;
subkey2: any;
};
aesCmac(key: any, message: any): any;
getMessageBlock(message: any, blockIndex: any): any;
getPaddedMessageBlock(message: any, blockIndex: any): any;
bitShiftLeft(buffer: any): any;
xor(bufferA: any, bufferB: any): any;
}