Check also certificate keys using elliptic curve algorithms
This commit is contained in:
parent
301499dc52
commit
8aa2516a55
1 changed files with 12 additions and 2 deletions
|
@ -609,6 +609,15 @@ const internalCertificate = {
|
||||||
return tempWrite(private_key, '/tmp')
|
return tempWrite(private_key, '/tmp')
|
||||||
.then((filepath) => {
|
.then((filepath) => {
|
||||||
return utils.exec('openssl rsa -in ' + filepath + ' -check -noout')
|
return utils.exec('openssl rsa -in ' + filepath + ' -check -noout')
|
||||||
|
.then((result) => {
|
||||||
|
if (!result.toLowerCase().includes('key ok')) {
|
||||||
|
throw new error.ValidationError(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
return true;
|
||||||
|
}).catch((err) => {
|
||||||
|
return utils.exec('openssl ec -in ' + filepath + ' -check -noout')
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (!result.toLowerCase().includes('key ok')) {
|
if (!result.toLowerCase().includes('key ok')) {
|
||||||
throw new error.ValidationError(result);
|
throw new error.ValidationError(result);
|
||||||
|
@ -621,6 +630,7 @@ const internalCertificate = {
|
||||||
throw new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err);
|
throw new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue