1
0
mirror of https://github.com/ArcticFoxes-net/ONC-Converter synced 2024-11-09 05:41:33 -05:00

Use the correct format for the client certificates

They're usually not in the PKCS#12 format but in X509.
This commit is contained in:
thomkeh 2018-07-17 15:41:28 +01:00 committed by GitHub
parent 552770e79b
commit 12e1f5501a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,11 +220,13 @@
let [cas, caGuids] = createCerts(keys, ovpn['ca'], 'Authority')
params['ServerCARefs'] = caGuids
certs = certs.concat(cas)
let [clientCerts, clientCertGuids] = createCerts(keys, ovpn['cert'], 'Client')
if (clientCerts[0]) {
params['ClientCertType'] = 'Ref'
params['ClientCertRef'] = clientCertGuids[0]
certs.push(clientCerts[0])
let [clientCerts, clientCertGuids] = createCerts(keys, ovpn['cert'], 'Authority')
if (clientCerts) {
params['ClientCertType'] = 'Pattern'
params['ClientCertPattern'] = {
'IssuerCARef': clientCertGuids
}
certs = certs.concat(clientCerts)
} else {
params['ClientCertType'] = 'None'
}
@ -344,14 +346,16 @@
alert("Please provide the file '" + certName + "' in 'Certificates and keys'")
}
let rawCerts = extractCas(cert)
const format = (certType === 'Authority') ? 'X509' : 'PKCS12'
for (const cert of rawCerts) {
const guid = `{${uuidv4()}}`
certGuids.push(guid)
certs.push({
let oncCert = {
'GUID': guid,
'Type': certType,
'X509': cert
})
'Type': certType
}
oncCert[format] = cert
certs.push(oncCert)
}
}
return [certs, certGuids]