MCPcopy Create free account
hub / github.com/apache/cloudstack / _generateKey

Method _generateKey

systemvm/agent/noVNC/core/crypto/dh.js:36–46  ·  view source on GitHub ↗
(algorithm)

Source from the content-addressed store, hash-verified

34 }
35
36 _generateKey(algorithm) {
37 const g = algorithm.g;
38 const p = algorithm.p;
39 this._keyBytes = p.length;
40 this._gBigInt = u8ArrayToBigInt(g);
41 this._pBigInt = u8ArrayToBigInt(p);
42 this._privateKey = window.crypto.getRandomValues(new Uint8Array(this._keyBytes));
43 this._privateKeyBigInt = u8ArrayToBigInt(this._privateKey);
44 this._publicKey = bigIntToU8Array(modPow(
45 this._gBigInt, this._privateKeyBigInt, this._pBigInt), this._keyBytes);
46 }
47
48 deriveBits(algorithm, length) {
49 const bytes = Math.ceil(length / 8);

Callers 1

generateKeyMethod · 0.95

Calls 3

u8ArrayToBigIntFunction · 0.90
bigIntToU8ArrayFunction · 0.90
modPowFunction · 0.90

Tested by

no test coverage detected