Fix fetching ephemeral keys from IK

This commit is contained in:
morrigan 2020-02-08 11:21:51 +01:00
parent ceb31929a2
commit 36e3462a82
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ export class IKHandshake implements IHandshake {
return this.ik.encryptWithAd(cs, Buffer.alloc(0), plaintext);
}
public getRemoteEphemeralKeys(): KeyPair {
public getLocalEphemeralKeys(): KeyPair {
if (!this.session.hs.e) {
throw new Error("Ephemeral keys do not exist.");
}

View File

@ -136,8 +136,8 @@ export class Noise implements INoiseConnection {
} catch (e) {
// IK failed, go to XX fallback
let ephemeralKeys;
if (!params.isInitiator) {
ephemeralKeys = ikHandshake.getRemoteEphemeralKeys();
if (params.isInitiator) {
ephemeralKeys = ikHandshake.getLocalEphemeralKeys();
}
return await this.performXXFallbackHandshake(params, payload, e.initialMsg, ephemeralKeys);
}