Permit a configurable number of iterations in the pkcs8 and pkcs12 subprograms.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Permit a configurable number of iterations in the pkcs8 and pkcs12 subprograms.

Matthew Ife
I recently learnt that the iteration value in these applications is a fixed 2048 value. This is relatively weak on most modern systems when it comes to offering any protection.

Instead of bumping up the number - I propose allowing the user to provide a value that they are comfortable with. I have provided some patches that will do this.

This is the first time I have patched into this application, I've tried to follow the formatting that I found in each file (pkcs12 and pkcs8 differs slightly in the way that they denote bracing etc).

Things to point out:-

- Not setting these values at all produces the default 2048 iterations.

- I removed the '-noiter' options from pkcs8 and pkcs12, since its now possible to do '-iter 1' instead.

 - More noteworthy for feedback however is I changed the semantic of '-maciter' in pkcs12 to now perform iterations rather than enable iterations which is the previous functionality. It says in the man page this flag was originally added for compatibility, but is now effectively a no-op.
So this change may break applications that do use this flag. I am *assuming* that this is a compatibility flag which is actually quite old and that changing its functionality is unlikely to cause any significant impact to anybody, however since I do not know when the flag was added and when the flag became redundant I tentatively await feedback here.

I separated the patches into 3 files, one is a documentation update.

I tested this works against the latest snapshot which seems to work for me. Openssl already does the right thing when a pkcs structure is provided with a large number of iterations (I tried it out with 131072 iters without issue).

I'd suggest giving it a try to make sure it works for other people first!

doc-iter.patch (3K) Download Attachment
pkcs12-iter.patch (2K) Download Attachment
pkcs8-iter.patch (1K) Download Attachment