Skip to content

Commit

Permalink
Add support for PKCS#8 format to X509PrivateKey#encrypted?
Browse files Browse the repository at this point in the history
X509PrivateKey#encrypted? supports only old format of RSA encrypted
private key. This PR adds support for PKCS#8 format (see RFC7468).
  • Loading branch information
prehor committed Aug 3, 2017
1 parent afb1078 commit 4a52e18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/serverspec/type/x509_private_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def valid?
end

def encrypted?
@runner.run_command("grep -wq \"^Proc-Type.*ENCRYPTED$\" #{name}").exit_status == 0
@runner.run_command("grep -Ewq \"^(Proc-Type.*ENCRYPTED|-----BEGIN ENCRYPTED PRIVATE KEY-----)$\" #{name}").exit_status == 0
end

def has_matching_certificate?(cert_file)
Expand Down

0 comments on commit 4a52e18

Please sign in to comment.