MCPcopy Create free account
hub / github.com/mscdex/ssh2 / start

Method start

lib/protocol/kex.js:1550–1566  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1548 this.hashName = hashName;
1549 }
1550 start() {
1551 if (!this._protocol._server) {
1552 this._protocol._debug && this._protocol._debug(
1553 'Outbound: Sending KEXDH_INIT'
1554 );
1555 const pubKey = this.getPublicKey();
1556 let p = this._protocol._packetRW.write.allocStartKEX;
1557 const packet =
1558 this._protocol._packetRW.write.alloc(1 + 4 + pubKey.length, true);
1559 packet[p] = MESSAGE.KEXDH_INIT;
1560 writeUInt32BE(packet, pubKey.length, ++p);
1561 packet.set(pubKey, p += 4);
1562 this._protocol._cipher.encrypt(
1563 this._protocol._packetRW.write.finalize(packet, true)
1564 );
1565 }
1566 }
1567 generateKeys() {
1568 if (!this._dh) {
1569 this._dh = createDiffieHellmanGroup(this.groupName);

Callers 3

connectMethod · 0.45
constructorMethod · 0.45
handleKexInitFunction · 0.45

Calls 5

writeUInt32BEFunction · 0.85
getPublicKeyMethod · 0.45
allocMethod · 0.45
encryptMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected