Use new values from /api/bootstrap

This commit is contained in:
pehmo1 2021-08-31 20:46:25 +03:00
parent c5a452933a
commit d8d5b5f6bc

View File

@ -103,11 +103,15 @@ function onKeyGen() {
let algorithm; let algorithm;
if (authority.certificate.algorithm == "rsa") { if (authority.certificate.algorithm == "rsa") {
algorithm = getAlgorithmParameters( algorithm = getAlgorithmParameters(
window.authority.certificate.key_type_specific, "generatekey"); window.authority.certificate.signature_algorithm, "generatekey");
} }
if (authority.certificate.algorithm == "ec") { if (authority.certificate.algorithm == "ec") {
if(authority.certificate.curve.startsWith("secp")) {
algorithm = getAlgorithmParameters( algorithm = getAlgorithmParameters(
window.authority.certificate.curve, "generatekey"); "ECDSA", "generatekey");
algorithm.algorithm.namedCurve =
`P-${authority.certificate.curve.slice(4,7)}`;
}
} }
if ("hash" in algorithm.algorithm) if ("hash" in algorithm.algorithm)
algorithm.algorithm.hash.name = window.authority.certificate.hash_algorithm; algorithm.algorithm.hash.name = window.authority.certificate.hash_algorithm;
@ -312,12 +316,6 @@ async function onHashChanged() {
success: async function(authority) { success: async function(authority) {
window.authority = authority window.authority = authority
// convert "sha512" to "SHA-512"
window.authority.certificate.hash_algorithm =
(window.authority.certificate.hash_algorithm.slice(0,3) +
"-" + window.authority.certificate.hash_algorithm.slice(3))
.toUpperCase();
var prefix = "unknown"; var prefix = "unknown";
for (i in DEVICE_KEYWORDS) { for (i in DEVICE_KEYWORDS) {
var keyword = DEVICE_KEYWORDS[i]; var keyword = DEVICE_KEYWORDS[i];