X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fvalidate_x509_rsa_key_pair.rb;h=93388e0d04aa8a3078be9d6d6d87763315c8d19a;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hp=fc9f23ff1c1d49de2ec7f8ee3d55385894a19a7e;hpb=6963202b4b62c2816655ac9532521b018fdf83bd;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb index fc9f23ff1..93388e0d0 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb @@ -1,24 +1,28 @@ +# +# validate_x509_rsa_key_pair.rb +# module Puppet::Parser::Functions + newfunction(:validate_x509_rsa_key_pair, :doc => <<-DOC + @summary + Validates a PEM-formatted X.509 certificate and RSA private key using + OpenSSL. Verifies that the certficate's signature was created from the + supplied key. - newfunction(:validate_x509_rsa_key_pair, :doc => <<-ENDHEREDOC - Validates a PEM-formatted X.509 certificate and RSA private key using - OpenSSL. Verifies that the certficate's signature was created from the - supplied key. + @return + Fail compilation if any value fails this check. - Fail compilation if any value fails this check. + ```validate_x509_rsa_key_pair($cert, $key)``` - validate_x509_rsa_key_pair($cert, $key) - - ENDHEREDOC - ) do |args| + DOC + ) do |args| require 'openssl' NUM_ARGS = 2 unless defined? NUM_ARGS - unless args.length == NUM_ARGS then + unless args.length == NUM_ARGS raise Puppet::ParseError, - ("validate_x509_rsa_key_pair(): wrong number of arguments (#{args.length}; must be #{NUM_ARGS})") + "validate_x509_rsa_key_pair(): wrong number of arguments (#{args.length}; must be #{NUM_ARGS})" end args.each do |arg| @@ -40,8 +44,7 @@ module Puppet::Parser::Functions end unless cert.verify(key) - raise Puppet::ParseError, "Certificate signature does not match supplied key" + raise Puppet::ParseError, 'Certificate signature does not match supplied key' end end - end