Crypto
Class with the cryptographic functions for the authentication protocol
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
concatPMSwithRandoms(pms: *, toRandom: *, fromRandom: *): * |
|
public |
decode a base64 value in a new Uint8Array |
|
public |
decryptAES(key: *, data: *, iv: *): * |
|
public |
decryptRSA(privKey: *, data: *): * |
|
public |
encode a byteArray value in base 64 encode |
|
public |
encryptAES(key: *, data: *, iv: *): * |
|
public |
encryptRSA(pubKey: *, data: *): * |
|
public |
generateIV(): byteArray Generates a 128 bit random value. |
|
public |
generateKeys(secret: byteArray, data: String): Array<byteArray> generates both users MAC and encryption keys. |
|
public |
generateMasterSecret(hmacKey: *, data: *): byteArray generates a masterKey secret (PMS) of 48 bytes (384 bits) using the premaster secret and two randoms |
|
public |
generatePMS(): byteArray generates a premaster secret (PMS) of 48 bytes (384 bits) randomly |
|
public |
generates a RSA public/private key pair with a modulus length of 2048 bits |
|
public |
generateRandom(): byteArray Generates a 256 bit random value. |
|
public |
creates a hash using the HMAC algorithm |
|
public |
signRSA(privKey: *, data: *): * |
|
public |
verifyHMAC(key: byteArray, data: string, signature: byteArray): boolean verifies an hash using the HMAC algorithm |
|
public |
verifyRSA(pubKey: *, data: *, signature: *): * |
Public Constructors
public constructor() source
Public Methods
public concatPMSwithRandoms(pms: *, toRandom: *, fromRandom: *): * source
Params:
Name | Type | Attribute | Description |
pms | * | ||
toRandom | * | ||
fromRandom | * |
Return:
* |
public decode(value: string): byteArray source
decode a base64 value in a new Uint8Array
Params:
Name | Type | Attribute | Description |
value | string | value encoded in base 64 |
Return:
byteArray | decodedValue |
public decryptAES(key: *, data: *, iv: *): * source
Params:
Name | Type | Attribute | Description |
key | * | ||
data | * | ||
iv | * |
Return:
* |
public decryptRSA(privKey: *, data: *): * source
Params:
Name | Type | Attribute | Description |
privKey | * | ||
data | * |
Return:
* |
public encode(value: byteArray): string source
encode a byteArray value in base 64 encode
Params:
Name | Type | Attribute | Description |
value | byteArray | byteArray value |
public encryptAES(key: *, data: *, iv: *): * source
Params:
Name | Type | Attribute | Description |
key | * | ||
data | * | ||
iv | * |
Return:
* |
public encryptRSA(pubKey: *, data: *): * source
Params:
Name | Type | Attribute | Description |
pubKey | * | ||
data | * |
Return:
* |
public generateIV(): byteArray source
Generates a 128 bit random value.
Return:
byteArray | array random value |
public generateKeys(secret: byteArray, data: String): Array<byteArray> source
generates both users MAC and encryption keys. generate as output an array with 4 byteArray each with 32 bytes
Params:
Name | Type | Attribute | Description |
secret | byteArray | secret to be used in the HMAC function |
|
data | String | information to be used as seed |
public generateMasterSecret(hmacKey: *, data: *): byteArray source
generates a masterKey secret (PMS) of 48 bytes (384 bits) using the premaster secret and two randoms
Params:
Name | Type | Attribute | Description |
hmacKey | * | ||
data | * |
Return:
byteArray | array master secret key with 48 bytes |
public generatePMS(): byteArray source
generates a premaster secret (PMS) of 48 bytes (384 bits) randomly
Return:
byteArray | array premaster secret key |
public generateRSAKeyPair(): JSON source
generates a RSA public/private key pair with a modulus length of 2048 bits
public generateRandom(): byteArray source
Generates a 256 bit random value. 32 bits are extrated from the machine time, the remaining are generated randomly
Return:
byteArray | array random value |
public hashHMAC(key: byteArray, data: string): byteArray source
creates a hash using the HMAC algorithm
Params:
Name | Type | Attribute | Description |
key | byteArray | key to be used in the hmac |
|
data | string | information to be hashed |
Return:
byteArray | signature resulting hash |
public signRSA(privKey: *, data: *): * source
Params:
Name | Type | Attribute | Description |
privKey | * | ||
data | * |
Return:
* |
public verifyHMAC(key: byteArray, data: string, signature: byteArray): boolean source
verifies an hash using the HMAC algorithm
Params:
Name | Type | Attribute | Description |
key | byteArray | key to be used in the hmac |
|
data | string | information to be hashed to compare |
|
signature | byteArray | hash to compare with the received data |
public verifyRSA(pubKey: *, data: *, signature: *): * source
Params:
Name | Type | Attribute | Description |
pubKey | * | ||
data | * | ||
signature | * |
Return:
* |