[BUG] x509_v2
private key issues
#64597
Labels
Bug
broken, incorrect, or confusing behavior
Milestone
x509_v2
private key issues
#64597
Description
x509_v2.create_private_key
cannot write an encrypted private key in PEM format to a passedpath
.x509_v2.verify_private_key
does not respect a passedpassphrase
parameter.x509_v2.encode_private_key
erroneously expects a hydrated private key object.x509_v2.encode_private_key
cannot read an encrypted private key.Setup
irrelevant
Steps to Reproduce the behavior
(1)
salt-call x509.create_private_key path=/tmp/privkey passphrase=hunter1
(2) Fix 1, then
salt-call x509.create_certificate path=/tmp/cert signing_private_key=/tmp/privkey signing_private_key_passphrase=hunter1
salt-call x509.verify_private_key /tmp/privkey /tmp/cert passphrase=hunter1
(3)
salt-call x509.create_private_key path=/tmp/privkey
salt-call x509.encode_private_key /tmp/privkey
(4) Evident from its parameters missing a
private_key_passphrase
one.Expected behavior
Success.
Screenshots
1:
PEM does not contain a single entry of type (?:RSA )?PRIVATE KEY:
2:
Passed invalid arguments: Private key is encrypted. Please provide a password..
3:
AttributeError: 'str' object has no attribute 'private_bytes'
4:
Passed invalid arguments: Private key is encrypted. Please provide a password..
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional small issues:
x509.private_key_managed
reports a newkeysize
asNone
if a key with a non-default keysize is implicitly changed to have the default onex509.create_certificate
overwrite
docs are confusingx509.encode_private_key
parameter docs are wrong_create_certificate_local
callsbuilder.sign
twice. Luckily, this does not result in two different certificates to be issued (verified in testing), but it's still ugly.The text was updated successfully, but these errors were encountered: