Provide our own randomness to elliptic

This commit is contained in:
Mahrud Sayrafi 2018-02-27 17:40:41 -08:00
parent ecc38d0c6e
commit 746d5032e8
No known key found for this signature in database
GPG Key ID: C24071B956C3245F

View File

@ -157,8 +157,14 @@ Curve.prototype.genKeyPair = async function () {
keyPair = await nodeGenKeyPair(this.name);
return new KeyPair(this.curve, keyPair);
}
const options = {
entropy: util.Uint8Array2str(random.getRandomBytes(32)), // 32 = (192 + 64) / 8
entropyEnc: 'string'
};
// TODO provide randomness to elliptic here
const r = await this.curve.genKeyPair(options);
const compact = this.curve.curve.type === 'edwards' || this.curve.curve.type === 'mont';
const r = await this.curve.genKeyPair();
if (this.keyType === enums.publicKey.eddsa) {
keyPair = { secret: r.getSecret() };
} else {