Skip to content

Commit

Permalink
Raise error when public key is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-ntrf committed May 8, 2024
1 parent 3e5e1b1 commit 87544ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/hiera/backend/eyaml/encryptors/pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def self.encrypt(plaintext)
public_key_rsa = OpenSSL::PKey::RSA.new(public_key_pem)
public_key_x509 = OpenSSL::X509::Certificate.new
public_key_x509.public_key = public_key_rsa.public_key
else
raise StandardError, "file #{public_key_pem} cannot be used to encrypt - invalid public key format"
end

cipher = OpenSSL::Cipher.new('aes-256-cbc')
Expand Down

0 comments on commit 87544ab

Please sign in to comment.