pycryptodome icon indicating copy to clipboard operation
pycryptodome copied to clipboard

Pkcs7

Open siccegge opened this issue 8 years ago • 2 comments

Hi there!

I'm currently in need for PKCS#7 support and therefore looking into it. Obviously the current state (as in this PR) is crap and should not be used as-is. However I do have some questions

The most pressing Problem seems to be the Encoding. PKCS#7 on purpose employes undefined length BER encoding which is near-impossible to fit onto the current asn.1 implementation (You only learn the length of an object once you have parsed all its (recursive) children.

On a lesser thing: having this be Crypto.IO.PKCS7 sounds fine? How do you actually test Python2.4 support? Do you all have some VM around that has this somewhat dated version opf python installed?

siccegge avatar Sep 08 '17 09:09 siccegge

Hi again!

This is now mostly enough of a hack to do what I immediately need. What remains is making the code actually "publishable" and nice for inclusion

I haven't really figured out how to deal with the BER stuff. I'm thinking of making the Der/Ber/.. thing a mixin to the existing datatypes maybe.

What are your opinions on using an already existing external asn.1 library?

siccegge avatar Sep 13 '17 12:09 siccegge

PKCS#7 is now supported:

from Crypto.Util.Padding import pad
padded-data = pad(data, block_size, 'pkcs7'). #pkcs7 is the default mode

This pull request should be closed.

@siccegge did you receive this?

Legorooj avatar Jan 02 '20 09:01 Legorooj