Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 780c6d9c

Přidáno uživatelem Jan Pašek před asi 4 roky(ů)

Re #8583 - Downloading certificate keys

Zobrazit rozdíly:

static/js/utilities.js
27 27
    return local.toJSON().slice(0,10);
28 28
});
29 29

  
30
// Get the certificate PEM data from the server and downloads it to users computer
30
/**
31
 * Download certificate given by id
32
 * @param id identifier of certificate to be downloaded
33
 */
31 34
function onCertificateDownload(id) {
32 35
    axios.get(API_URL + "certificates/" + id)
33 36
        .then(function (response) {
......
41 44
        });
42 45
}
43 46

  
44
// Get the certificate's chain of trust in PEM format from the server and downloads it to users computer
47
/**
48
 * Download root of chain of trust excluding root of given certificate
49
 * @param id identifier of certificate whose chain shall be downloaded
50
 */
45 51
function onCertificateChainDownload(id) {
46 52
    axios.get(API_URL + "certificates/" + id + "/chain")
47 53
        .then(function (response) {
......
56 62
        });
57 63
}
58 64

  
59
// Get the certificate's root CA as PEM data from the server and downloads it to users computer
65
/**
66
 * Download root of chain of trust corresponding to the given certificate
67
 * @param id identifier of certificate whose root shall be downloaded
68
 */
60 69
function onCertificateRootDownload(id) {
61 70
    axios.get(API_URL + "certificates/" + id + "/root")
62 71
        .then(function (response) {
......
69 78
        .catch(function (error) {
70 79
            console.log(error);
71 80
        });
81
}
82

  
83
/**
84
 * Download public key associated with the selected certificate
85
 * @param id identifier of certificate whose pub. key shall be downloaded
86
 */
87
function onPublicKeyDownload(id) {
88
    axios.get(API_URL + "certificates/" + id + "/publickey")
89
        .then(function (response) {
90
            if (response.data["success"]) {
91
                download(id + "_public_key.pem", response.data["data"])
92
            } else
93
                console.log("Error occurred while downloading the certificate's public key") // TODO more action may be required
94
        })
95
        .catch(function (error) {
96
            console.log(error);
97
        });
98
}
99

  
100
/**
101
 * Download public key associated with the selected certificate
102
 * @param id identifier of certificate whose pub. key shall be downloaded
103
 */
104
function onPrivateKeyDownload(id) {
105
    axios.get(API_URL + "certificates/" + id + "/privatekey")
106
        .then(function (response) {
107
            if (response.data["success"]) {
108
                download(id + "_private_key.pem", response.data["data"])
109
            } else
110
                console.log("Error occurred while downloading the certificate's private key") // TODO more action may be required
111
        })
112
        .catch(function (error) {
113
            console.log(error);
114
        });
72 115
}

Také k dispozici: Unified diff