mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
improve key import
- support importing encrypted and unencrypted PKCS#8 DER formatted keys
This commit is contained in:
parent
28c63fbaa4
commit
2b91c11d5a
@ -1,4 +1,5 @@
|
||||
|
||||
* support loading DER formatted PKCS#8 keys
|
||||
* ease commandline use
|
||||
* add DH param generation menu entry
|
||||
* improve token handling and PIN changing dialogs
|
||||
|
||||
@ -278,6 +278,21 @@ void pki_evp::fload(const QString fname)
|
||||
rewind(fp);
|
||||
pkey = d2i_PrivateKey_fp(fp, NULL);
|
||||
}
|
||||
if (!pkey) {
|
||||
ign_openssl_error();
|
||||
rewind(fp);
|
||||
pkey = d2i_PKCS8PrivateKey_fp(fp, NULL, cb, &p);
|
||||
}
|
||||
if (!pkey) {
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
ign_openssl_error();
|
||||
rewind(fp);
|
||||
p8inf = d2i_PKCS8_PRIV_KEY_INFO_fp(fp, NULL);
|
||||
if (p8inf) {
|
||||
pkey = EVP_PKCS82PKEY(p8inf);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
}
|
||||
}
|
||||
if (!pkey) {
|
||||
ign_openssl_error();
|
||||
rewind(fp);
|
||||
@ -292,7 +307,7 @@ void pki_evp::fload(const QString fname)
|
||||
if (ign_openssl_error()) {
|
||||
if (pkey)
|
||||
EVP_PKEY_free(pkey);
|
||||
throw errorEx(tr("Unable to load the private key in file %1. Tried PEM and DER private and public key types.").arg(fname));
|
||||
throw errorEx(tr("Unable to load the private key in file %1. Tried PEM and DER private, public and PKCS#8 key types.").arg(fname));
|
||||
}
|
||||
if (pkey){
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user