I just finished some code that adds PKCS#8 encryption to PyCrypto:
https://github.com/dlitz/pycrypto/pull/32
Incidentally, it will now raise an exception when you try to do:
k.exportKey('DER', passphrase='foo')
That happens because PKCS#1 is the default encoding and it does not support encryption, unless you combine it with PEM.
However, if you do:
k.exportKey('DER', passphrase='foo', pkcs=8)
You will obtain a private key correctly encrypted according to PKCS#8.
I just finished some code that adds PKCS#8 encryption to PyCrypto:
https:/ /github. com/dlitz/ pycrypto/ pull/32
Incidentally, it will now raise an exception when you try to do:
k.exportKey('DER', passphrase='foo')
That happens because PKCS#1 is the default encoding and it does not support encryption, unless you combine it with PEM.
However, if you do:
k.exportKey('DER', passphrase='foo', pkcs=8)
You will obtain a private key correctly encrypted according to PKCS#8.