[Cryptography-dev] Three openssl(1) commands

2021-08-02 Thread Dan Stromberg
Hi people. We have some Python (CPython) code that uses openssl(1) via a subprocess at present. I'm coming to believe this isn't terribly secure though, so I looked for an openssl wrapper for CPython. What I found was PyOpenSSL, which recommends using pyca/cryptography instead for almost everyth

[Cryptography-dev] openssl command one that needs a pyca/cryptography rewrite

2021-08-02 Thread Dan Stromberg
So the first command looks like this: ['openssl', 'rsa', '-passin', 'pass:{0}'.format(record.password)] It's just accepting the following on stdin, formatted like: -BEGIN RSA PRIVATE KEY- ... -END RSA PRIVATE KEY- ...and outputting something that'll later be passed to ssh-keygen -

[Cryptography-dev] openssl command two that needs a pyca/cryptography rewrite

2021-08-02 Thread Dan Stromberg
The second command looks like: ['openssl', 'genrsa', '-aes128', '-passout', 'stdin', '2048'] I believe this is generating a public key, that will later be used by ssh. This one probably isn't much of a problem, but it might be better to go all pyca/cryptography (one dependency) rather than openss

[Cryptography-dev] openssl command three that a pyca/cryptography rewrite

2021-08-02 Thread Dan Stromberg
The third command looks like: ["openssl", "rsa", "-passin", "pass:{0}".format(newpassword), "-pubout"] I think here we're obtaining a new public key. Any suggestions as to how this could be rewritten to use pyca/cryptography? Thanks! ___ Cryptography-d