Im working in a project that use a "Pkcs12", ".cer and .key" files format.
I need to validate the certificates for authorization and sign purpose with the "pkcs12, x.509" i don't have troubles to parse the files and validate the ownership.
But with the "pkcs8" i don't know how to decrypt and parse to validate the "x509 public key" and the "RSA key" of private key matches.
Currently im Vuejs for the user Interface, FileReader API and "Forge" library to load the "x509" and decrypt the ".key". With the "x509" file i complete the process with the following code:
let certBase64 = '';
let keyBase64 = '';
let certificate = {};
let fileReader = new FileReader();
fileReader.onload = () => {
try {
if(event.target.name === 'cer') {
certBase64 = fileReader.result.split("base64,")[1]
} else if(event.target.name === 'key') {
keyBase64 = fileReader.result.split("base64,")[1]
}
} catch (e) {
console.error(e)
}
}
fileReader.readAsDataURL(event.target.files[0])
let certDecoded = util.decode64(certBase64)
certificate = pki.certificateFromPem(certDecoded)
Hy!
Im working in a project that use a "Pkcs12", ".cer and .key" files format.
I need to validate the certificates for authorization and sign purpose with the "pkcs12, x.509" i don't have troubles to parse the files and validate the ownership.
But with the "pkcs8" i don't know how to decrypt and parse to validate the "x509 public key" and the "RSA key" of private key matches.
Currently im Vuejs for the user Interface, FileReader API and "Forge" library to load the "x509" and decrypt the ".key". With the "x509" file i complete the process with the following code:
Maybe my question it's bad oriented...
Thanks for all.