-
Notifications
You must be signed in to change notification settings - Fork 101
Description
I tried to enroll EC keys from NDES, but get the error:
./sscep: cannot read inner PKCS#7
140544891217216:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1149:
140544891217216:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:309:Type=PKCS7_RECIP_INFO
140544891217216:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:614:Field=recipientinfo, Type=PKCS7_ENVELOPE
140544891217216:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:646:
140544891217216:error:0D08403A:asn1 encoding routines:asn1_template_ex_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:496:Field=d.enveloped, Type=PKCS7
./sscep: sending certificate request
./sscep: valid response from server
./sscep: reply transaction id: 02F10BF97571D8DECFF27F80E49C8F5D
./sscep: pkistatus: SUCCESS
I suspect it would work if sscep used OpenSSL CMS routines instead of PKCS#7.
I initially thought it was a bug in OpenSSL, so I filed a bug openssl/openssl#24685. But according to the explanation I received:
The OpenSSL pkcs7 app implements the original PKCS7 as defined in RFC2315. The original PKCS7 supports key transport (which RSA uses), but does not have support for key agreement (which EC keys use). IETF subsequently developed CMS (the latest version of which is in RFC5652). CMS is largely backwards compatible with PKCS7, but some changes were made. So you can take a pkcs7 structure and read it as CMS. The reverse is not (necessarily) true.
If I understand it correctly, then it might be possible that using CMS instead of PKCS#7 could work for both RSA and EC keys.