[openssl-users] PKCS7->signerInfo->encryptedDigest not type X509_SIG

Jakob Bohm jb-openssl at wisemo.com
Sat Sep 19 21:09:16 UTC 2015


On 19/09/2015 15:34, Michael Heide wrote:
> Am Wed, 16 Sep 2015 08:55:51 +0200 schrieb Michael Heide <michael.heide at student.uni-siegen.de>:
>
>> My question now is: how to (proper) handle it?
> Maybe a more sensible way to handle those signatures with OpenSSL is to still not allow such things but instead return an error indicating success if it /would/ be allowed to do it this way? The application then can check for this specific error and translate it into success. (meaning: this specific error is set if OpenSSL successfully compared both hashes and is - as such - not really a fatal error.)
>
> This way OpenSSLs default behaviour won't change, it's still an error to not encapsulate the encryptedDigest in an asn1 structure. But the application programmer is able to handle it.
>
> see attachment.
>
> (Maybe a callback-function at the place where the error gets generated would be a better option. But I think that would be a more extensive change in OpenSSL.)
I am in no position to include this, but here are a few
thoughts on improving your patch.

1. The error should not call this "plain", this would lead
   to the same misunderstanding I had earlier.  Try something
   like "RSA_R_PKCS1_1_DIGEST_ONLY_VALID" to indicate that this
   is a variant of PKCS#1 v1.x signature formatting (the outer
   part with 00|01|FF....|00 is still there), but without the
   inner DER encoded ASN.1 structure.

2. Because the hash algorithm OID is not there, something
   needs to check that the hash algorithm is the right one for
   this RSA public key.  This test is really in another layer
   (PKCS#7/CMS), but needs to be stronger in this case due to
   the lack of an embedded hash algorithm identifier inside the
   RSA calculation.

3. It would be really nice if someone in the know would
   explain under which conditions this alternative signature
   algorithm is used and/or necessary.


Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150919/664242fb/attachment.html>


More information about the openssl-users mailing list