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 9, 2024
1 parent 6e40e46 commit be1b85f
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 @@ -53,6 +53,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 be1b85f

Please sign in to comment.