WebCrypto GOST: PFX Key Store

The tool is intended for experimentation with data processing

Create PFX Key Store

Example of PrivateKey, Certificate and CRL contents

                    
                    
                    
                    
                    
                    
Create PFX Key Store method
new gostCrypto.keys.KeyStore({
    alias: {
        key: certAndKey.textContent,
        certs: [certAndKey.textContent],
        crls: [certAndKey.textContent]
    }
}).store(newPassword.value, provider.value).then(function (pfx) {
    keyStore.textContent = pfx.encode('PEM');
    storePassword.value = newPassword.value;
    storeMessage.textContent = 'Сontents are stored';
})['catch'](function (reason) {
    alert(reason.message);
});

Read PFX Key Store

PFX Key Store

                    
Read PFX Key Store method
new gostCrypto.keys.KeyStore().load(keyStore.textContent, 
    storePassword.value, true).then(function (store) {
    certAndKey.textContent = '';
    store.aliases().forEach(function(name) {
        var entry = store.getEntry(name);
        if (entry.key)
            certAndKey.textContent += entry.key.encode('PEM') + '\r\n\r\n';
        if (entry.certs) {
            entry.certs.forEach(function (cert) {
                certAndKey.textContent += cert.encode('PEM') + '\r\n\r\n';
            });
        }
        if (entry.crls) {
            entry.crls.forEach(function (crl) {
                certAndKey.textContent += crl.encode('PEM') + '\r\n\r\n';
            });
        }
        loadMessage.textContent = 'Сontents are loaded';
    });
})['catch'](function (reason) {
    alert(reason.message);
});