Skip to content

Commit

Permalink
Copy recipient info issuer in x509 when decrypting
Browse files Browse the repository at this point in the history
In case the keys have been not been generated with
hiera-eyaml, the issuer info might be different than
the default one generated by Ruby. This info have to
match for decrypt to run without error.
  • Loading branch information
cmd-ntrf committed May 10, 2024
1 parent 760fd05 commit 2f60a4a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/hiera/backend/eyaml/encryptors/pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def self.decrypt(ciphertext)

public_key_x509 = OpenSSL::X509::Certificate.new
public_key_x509.serial = pkcs7.recipients[0].serial
public_key_x509.issuer = pkcs7.recipients[0].issuer
public_key_x509.public_key = private_key_rsa.public_key

pkcs7.decrypt(private_key_rsa, public_key_x509)
Expand Down

0 comments on commit 2f60a4a

Please sign in to comment.