Check also certificate keys using elliptic curve algorithms

This commit is contained in:
Michael Koch 2020-10-17 17:20:50 +02:00
parent 301499dc52
commit 8aa2516a55

View file

@ -617,8 +617,18 @@ const internalCertificate = {
fs.unlinkSync(filepath); fs.unlinkSync(filepath);
return true; return true;
}).catch((err) => { }).catch((err) => {
fs.unlinkSync(filepath); return utils.exec('openssl ec -in ' + filepath + ' -check -noout')
throw new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err); .then((result) => {
if (!result.toLowerCase().includes('key ok')) {
throw new error.ValidationError(result);
}
fs.unlinkSync(filepath);
return true;
}).catch((err) => {
fs.unlinkSync(filepath);
throw new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err);
});
}); });
}); });
}, },