diff --git a/lib/hiera/backend/eyaml/encryptors/pkcs7.rb b/lib/hiera/backend/eyaml/encryptors/pkcs7.rb index 95fbf0e..f17e5f9 100644 --- a/lib/hiera/backend/eyaml/encryptors/pkcs7.rb +++ b/lib/hiera/backend/eyaml/encryptors/pkcs7.rb @@ -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')