RSA import pkcs8 #157
No reviewers
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt!157
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/rsa_import_pkcs8"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
as requested in #79
Indentation is not 3-spaces
from me this PR is ready for review / merge
Maybe:
Although the current implementation does not support encrypted (password protected) pkcs8 keys, it might be a good idea to support the password in the function call.
Coverage increased (+0.02%) to 87.579% when pulling fda842158b1fa9083e529365841c930105bc85f9 on feature/rsa_import_pkcs8 into
77019928ddon develop.Sounds like a good idea! I don't know the details about the passwords that can be used, but if it can also be a binary stream I'd prefer to use
..., const void* passwd, unsigned long passwdlen, .... In case that it's limited to a "string" I'd prefer..., const char* passwd, rsa_key* ....passwords are not limited to strings
Coverage increased (+0.02%) to 87.821% when pulling 09efc63b787a761b1c09168fcb6d6a46863227f7 on feature/rsa_import_pkcs8 into
fbe7d222c3on develop.@ -0,0 +95,4 @@if (err == CRYPT_OK) {LTC_UNUSED_PARAM(passwd);LTC_UNUSED_PARAM(passwdlen);/* XXX: TODO encrypted pkcs8 not implemented yet */I just remembered that there was something on the ML https://groups.google.com/d/msg/libtom/sFdia0rRcfM/4yIzA_crK0AJ
I don't know if this is what we need here, but it looks kinda similar :)
Will you have a look? Otherwise I'll do it when I have the time.
[edit] we should also keep this list in mind http://oid-info.com/get/1.2.840.113549.1.5 [/edit]
@ -0,0 +95,4 @@if (err == CRYPT_OK) {LTC_UNUSED_PARAM(passwd);LTC_UNUSED_PARAM(passwdlen);/* XXX: TODO encrypted pkcs8 not implemented yet */Exactly, to handle the encrypted keys we should be able to decrypt via
pbeWithMD5AndDES-CBCand/or similar.The latest spec for PBES1 / PBES2 are IMO in RFC 8018 (aka PKCS5 v2.1)
The code from mailing list looks similar to PbeWithMD5AndTripleDES
Anyway, it might be a good idea to have something like
src\misc\pkcs5\pbes1.c+src\misc\pkcs5\pbes2.cso that we can later reuse it inecc_import_pkcs8or event implement stuff likersa_import_pkcs12.Slightly OT: this PKCS8 related bug report related to EC keys https://github.com/DCIT/perl-CryptX/issues/28 demonstrates that PKCS8 is not easy
We can merge this one (as soon as it built) in my opinion and open a new issue for encrypted pkcs#8 files
I would also merge this one but there are 2 things to mention if anybody will hack on this in the future:
1/ This implementation does not support password protected keys (yes, we know it).
2/ The implementation more or less follows https://tools.ietf.org/html/rfc5208; however, it was obsoleted by https://tools.ietf.org/html/rfc5958 Which basically means that there can exist some correct/valid pkcs#8 formatted keys that my implementation cannot load - see pkcs8 related troubles in https://github.com/DCIT/perl-CryptX/issues/28
I was thinking about replacing the current implementation with our ASN.1 flexi parser.
@sjaeckel could you please merge this one?
@karel-m I added another commit, can you please review?
Your last commit is correct