Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/internal/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,12 @@ const internalCertificate = {
checkPrivateKey: (private_key) => {
return tempWrite(private_key, '/tmp')
.then((filepath) => {
return utils.exec('openssl rsa -in ' + filepath + ' -check -noout')
let key_type = private_key.includes('-----BEGIN RSA') ? 'rsa' : 'ec';
return utils.exec('openssl ' + key_type + ' -in ' + filepath + ' -check -noout 2>&1 ')
.then((result) => {
if (!result.toLowerCase().includes('key ok')) {
throw new error.ValidationError(result);
if (!result.toLowerCase().includes('key ok') && !result.toLowerCase().includes('key valid') ) {
throw new error.ValidationError('Result Validation Error: ' + result);
}

fs.unlinkSync(filepath);
return true;
}).catch((err) => {
Expand Down