1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|iam] add proper error messages

This commit is contained in:
Blake Gentry 2011-07-20 22:10:41 -07:00
parent 00e38b3f9c
commit 674f11a104

View file

@ -54,7 +54,12 @@ module Fog
cert = OpenSSL::X509::Certificate.new(certificate)
key = OpenSSL::PKey::RSA.new(private_key)
rescue OpenSSL::X509::CertificateError, OpenSSL::PKey::RSAError => e
raise Fog::AWS::IAM::MalformedCertificate.new
message = if e.is_a?(OpenSSL::X509::CertificateError)
"Invalid Public Key Certificate."
else
"Invalid Private Key."
end
raise Fog::AWS::IAM::MalformedCertificate.new(message)
end
unless cert.check_private_key(key)